summaryrefslogtreecommitdiff
path: root/protocols/Skype/src/skype_runtime.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'protocols/Skype/src/skype_runtime.cpp')
-rw-r--r--protocols/Skype/src/skype_runtime.cpp28
1 files changed, 14 insertions, 14 deletions
diff --git a/protocols/Skype/src/skype_runtime.cpp b/protocols/Skype/src/skype_runtime.cpp
index a5c41d58c2..9b605d3488 100644
--- a/protocols/Skype/src/skype_runtime.cpp
+++ b/protocols/Skype/src/skype_runtime.cpp
@@ -18,29 +18,29 @@ char *CSkypeProto::LoadKeyPair()
if (pLockedResource == NULL)
return NULL;
- aes_context ctx;
- char *key = (char*)mir_base64_decode(MY_KEY, NULL);
-
- ::aes_set_key(&ctx, (unsigned char *)key, 128);
- ::mir_free(key);
-
int length = ::SizeofResource(g_hInstance, hResource);
if (length == 0)
return NULL;
- char *pData = (char *)alloca(length+1);
- memcpy(pData, pLockedResource, length);
- pData[length] = 0;
+ char* pData = new char[length + 1];
+ ::memcpy(pData, pLockedResource, length);
+ pData[length] = 0;
- unsigned char *bufD = (unsigned char *)::mir_alloc(length * 2);
- unsigned char *tmpD = (unsigned char *)mir_base64_decode(pData, NULL);
+ unsigned char *tmpD = (unsigned char *)::mir_base64_decode(pData, NULL);
+ unsigned char *result = (unsigned char *)::mir_alloc(length*2);
+ delete [] pData;
+
+ aes_context ctx;
+ char *key = (char*)::mir_base64_decode(MY_KEY, NULL);
+ ::aes_set_key(&ctx, (unsigned char *)key, 128);
+ ::mir_free(key);
for (int i = 0; i < length; i += 16)
- aes_decrypt(&ctx, tmpD + i, bufD + i);
+ aes_decrypt(&ctx, tmpD + i, result + i);
::mir_free(tmpD);
- //bufD[length] = 0; //cert should be null terminated
- return (char *)bufD;
+ result[length] = 0;
+ return (char *)result;
}
int CSkypeProto::StartSkypeRuntime(const wchar_t *profileName)