Browse Source

mainreplay: fix leak in decrypt_aes_128() (#1737)

In decrypt_aes_128() at src/apps/replay/mainreplay.c, it calls
base64decode() to allocates memory in encryptedText, but forgets to free
encryptedText in the end of this function. Add free() after finished
using encryptedText.

Signed-off-by: Lidong Yan <[email protected]>
Lidong Yan 1 tháng trước cách đây
mục cha
commit
439914716d
1 tập tin đã thay đổi với 1 bổ sung0 xóa
  1. 1 0
      src/apps/relay/mainrelay.c

+ 1 - 0
src/apps/relay/mainrelay.c

@@ -1841,6 +1841,7 @@ void decrypt_aes_128(char *in, const unsigned char *mykey) {
   CRYPTO_ctr128_encrypt(encryptedText, outdata, newTotalSize, &key, state.ivec, state.ecount, &state.num,
                         (block128_f)AES_encrypt);
 
+  free(encryptedText);
   strcat(last, (char *)outdata);
   printf("%s\n", last);
 }