From 010e4df16c3fc963155cd1e398748d2b15974e3e Mon Sep 17 00:00:00 2001 From: Kirill Volinsky Date: Sun, 28 Oct 2012 11:03:16 +0000 Subject: fixed memmory corruption git-svn-id: http://svn.miranda-ng.org/main/trunk@2098 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/Skype/src/skype.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'protocols/Skype/src/skype.cpp') diff --git a/protocols/Skype/src/skype.cpp b/protocols/Skype/src/skype.cpp index 909065ad27..d8428b9b6a 100644 --- a/protocols/Skype/src/skype.cpp +++ b/protocols/Skype/src/skype.cpp @@ -147,15 +147,14 @@ char* LoadKeyPair() pData[dwResSize] = 0; int basedecoded = decodeSize(pData); GlobalUnlock(hResource); - GlobalFree(hResource); unsigned char *bufD = (unsigned char*)mir_alloc(basedecoded + 1); unsigned char *tmpD = (unsigned char*)mir_alloc(basedecoded + 1); decode(pData, tmpD, basedecoded); - for (int i = 0; i <= basedecoded; i += 16) { + for (int i = 0; i < basedecoded; i += 16) { aes_decrypt(&ctx, tmpD+i, bufD+i); } mir_free(tmpD); - bufD[basedecoded-1] = 0; //cert should be null terminated + bufD[basedecoded] = 0; //cert should be null terminated return (char*)bufD; } return NULL; -- cgit v1.2.3