summaryrefslogtreecommitdiff
path: root/plugins/CryptoPP/src/cpp_keys.cpp
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2013-10-22 19:30:48 +0000
committerGeorge Hazan <george.hazan@gmail.com>2013-10-22 19:30:48 +0000
commit4164b967c13c87fd2a5a3459b037a6a823faa872 (patch)
tree873ff8f5ba9900c06a444c4b0d2e46651c1eaf37 /plugins/CryptoPP/src/cpp_keys.cpp
parent5a6789f0c45660feb1dbd5ada8438c43b8f6bb2c (diff)
SecureIM:
- fixed crash with memory allocation conflict; - version bump git-svn-id: http://svn.miranda-ng.org/main/trunk@6593 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/CryptoPP/src/cpp_keys.cpp')
-rw-r--r--plugins/CryptoPP/src/cpp_keys.cpp16
1 files changed, 7 insertions, 9 deletions
diff --git a/plugins/CryptoPP/src/cpp_keys.cpp b/plugins/CryptoPP/src/cpp_keys.cpp
index c1b2d9efb5..990ead35ec 100644
--- a/plugins/CryptoPP/src/cpp_keys.cpp
+++ b/plugins/CryptoPP/src/cpp_keys.cpp
@@ -57,11 +57,10 @@ LPSTR __cdecl cpp_init_keya(HANDLE context, int features) {
}
memcpy((PVOID)&publ1[KEYSIZE],(PVOID)&send_features,2);
- SAFE_FREE(ptr->tmp);
if (ptr->mode & MODE_BASE64 || features & FEATURES_NEWPG)
- ptr->tmp = mir_base64_encode(publ1,KEYSIZE+2);
+ replaceStr(ptr->tmp, mir_base64_encode(publ1,KEYSIZE+2));
else
- ptr->tmp = base16encode((LPSTR)&publ1,KEYSIZE+2);
+ replaceStr(ptr->tmp, base16encode((LPSTR)&publ1,KEYSIZE+2));
return ptr->tmp;
}
@@ -79,7 +78,7 @@ int __cdecl cpp_init_keyb(HANDLE context, LPCSTR key) {
LPSTR pub_binary;
if ((clen==KEYSIZE*2) || (clen==(KEYSIZE+2)*2))
pub_binary = base16decode(key,&clen);
- else
+ else
pub_binary = (LPSTR)mir_base64_decode(key,&clen);
if ( !pub_binary || (clen!=KEYSIZE && clen!=KEYSIZE+2) ) {
@@ -87,7 +86,7 @@ int __cdecl cpp_init_keyb(HANDLE context, LPCSTR key) {
Sent_NetLog("cpp_init_keyb: error bad_keyb");
#endif
ptr->error = ERROR_BAD_KEYB;
- SAFE_FREE(pub_binary);
+ mir_free(pub_binary);
return 0;
}
@@ -121,14 +120,14 @@ int __cdecl cpp_init_keyb(HANDLE context, LPCSTR key) {
}
}
- SAFE_FREE(p->KeyB);
+ mir_free(p->KeyB);
p->KeyB = (PBYTE) pub_binary;
if (p->PubA && memcmp(p->PubA,p->KeyB,KEYSIZE)==0) {
#if defined(_DEBUG) || defined(NETLIB_LOG)
Sent_NetLog("cpp_init_keyb: error bad_keyb keya==keyb");
#endif
- SAFE_FREE(p->KeyB);
+ mir_free(p->KeyB);
ptr->error = ERROR_BAD_KEYB;
return 0;
}
@@ -156,8 +155,7 @@ int __cdecl cpp_calc_keyx(HANDLE context) {
// not needed anymore
SAFE_FREE(p->PubA);
SAFE_FREE(p->KeyA);
- SAFE_FREE(p->KeyB);
-// SAFE_DELETE(p->dh);
+ mir_free(p->KeyB); p->KeyB = 0;
BYTE buffer[Tiger::DIGESTSIZE]; // buffer for hash
memset(buffer,0,sizeof(buffer));