]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Fix bug 8845: check the right length of memory in aes unit tests
authorNick Mathewson <nickm@torproject.org>
Wed, 8 May 2013 16:59:08 +0000 (12:59 -0400)
committerNick Mathewson <nickm@torproject.org>
Wed, 8 May 2013 16:59:43 +0000 (12:59 -0400)
This couldn't actually be a buffer overrun unless AES somehow turned
into memcpy, but still it's good to fix it.

changes/bug8845 [new file with mode: 0644]
src/test/test_crypto.c

diff --git a/changes/bug8845 b/changes/bug8845
new file mode 100644 (file)
index 0000000..ace043a
--- /dev/null
@@ -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.
index fcaa0813e7fb0de70d2961a751bedbc64774a1e9..f92bfd673eca3b43551211d6285e7fbb4efaf6ec 100644 (file)
@@ -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,