[tor-commits] [tor/master] Fix bug 8845: check the right length of memory in aes unit tests

nickm at torproject.org nickm at torproject.org
Wed May 8 17:02:01 UTC 2013


commit 7d3fd858388ddd4916c604ed5ab3c8cfc72dfd1c
Author: Nick Mathewson <nickm at torproject.org>
Date:   Wed May 8 12:59:08 2013 -0400

    Fix bug 8845: check the right length of memory in aes unit tests
    
    This couldn't actually be a buffer overrun unless AES somehow turned
    into memcpy, but still it's good to fix it.
---
 changes/bug8845        |    3 +++
 src/test/test_crypto.c |    2 +-
 2 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/changes/bug8845 b/changes/bug8845
new file mode 100644
index 0000000..ace043a
--- /dev/null
+++ b/changes/bug8845
@@ -0,0 +1,3 @@
+  o Minor bugfixes (test):
+    - Fix an impossible buffer overrun in the AES unit tests. Fixes bug 8845;
+      bugfix on 0.2.0.7-alpha. Found by eugenis.
diff --git a/src/test/test_crypto.c b/src/test/test_crypto.c
index fcaa081..f92bfd6 100644
--- a/src/test/test_crypto.c
+++ b/src/test/test_crypto.c
@@ -730,7 +730,7 @@ test_crypto_aes_iv(void *arg)
   /* Decrypt with the wrong key. */
   decrypted_size = crypto_cipher_decrypt_with_iv(key2, decrypted2, 4095,
                                              encrypted1, encrypted_size);
-  test_memneq(plain, decrypted2, encrypted_size);
+  test_memneq(plain, decrypted2, decrypted_size);
   /* Alter the initialization vector. */
   encrypted1[0] += 42;
   decrypted_size = crypto_cipher_decrypt_with_iv(key1, decrypted1, 4095,





More information about the tor-commits mailing list