Переглянути джерело

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 місяць тому
батько
коміт
439914716d
1 змінених файлів з 1 додано та 0 видалено
  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);
 }