Преглед на файлове

Zero a cipher completely before freeing it

We used to only zero the first ptrsize bytes of the cipher. Since
cipher is large enough, we didn't zero too many bytes. Discovered
and fixed by ekir. Fixes bug 1254.
Sebastian Hahn преди 15 години
родител
ревизия
f5112fa487
променени са 2 файла, в които са добавени 4 реда и са изтрити 1 реда
  1. 3 0
      ChangeLog
  2. 1 1
      src/common/aes.c

+ 3 - 0
ChangeLog

@@ -45,6 +45,9 @@ Changes in version 0.2.2.9-alpha - 2010-02-22
     - Fix a spec conformance issue: the network-status-version token
       must be the first token in a v3 consensus or vote. Discovered by
       parakeep. Bugfix on 0.2.0.3-alpha.
+    - When freeing a cipher, zero it out completely. We only zeroed
+      the first ptrsize bytes. Bugfix on tor-0.0.2pre8. Discovered
+      and patched by ekir. Fixes bug 1254.
 
   o Code simplifications and refactoring:
     - Generate our manpage and HTML documentation using Asciidoc. This

+ 1 - 1
src/common/aes.c

@@ -268,7 +268,7 @@ aes_free_cipher(aes_cnt_cipher_t *cipher)
 #ifdef USE_OPENSSL_EVP
   EVP_CIPHER_CTX_cleanup(&cipher->key);
 #endif
-  memset(cipher, 0, sizeof(cipher));
+  memset(cipher, 0, sizeof(aes_cnt_cipher_t));
   tor_free(cipher);
 }