diff options
author | Nick Mathewson <nickm@torproject.org> | 2003-06-20 08:17:25 +0000 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2003-06-20 08:17:25 +0000 |
commit | 49f082fcee43d23a3f25b92d1c3f1ce4c235cd21 (patch) | |
tree | 2c0b496001dc46c71667564c9d1a83f0a8a09f3e | |
parent | fba684586f5bc8662d618eb1b782426a22fb980c (diff) | |
download | tor-49f082fcee43d23a3f25b92d1c3f1ce4c235cd21.tar tor-49f082fcee43d23a3f25b92d1c3f1ce4c235cd21.tar.gz |
Fix a bug where we'd sometimes run off the end of an array while
testing stream encryption.
svn:r339
-rw-r--r-- | src/or/test.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/or/test.c b/src/or/test.c index d9a2d69ff..e95696112 100644 --- a/src/or/test.c +++ b/src/or/test.c @@ -269,13 +269,13 @@ test_crypto() } test_memeq(data1, data3, 560); /* Now encrypt 3 at a time, and get 5 at a time. */ - for (j = 560; j < 1024; j += 3) { + for (j = 560; j < 1024-5; j += 3) { crypto_cipher_encrypt(env1, data1+j, 3, data2+j); } - for (j = 560; j < 1024; j += 5) { + for (j = 560; j < 1024-5; j += 5) { crypto_cipher_decrypt(env2, data2+j, 5, data3+j); } - test_memeq(data1, data3, 1024-4); + test_memeq(data1, data3, 1024-5); /* Now make sure that when we encrypt with different chunk sizes, we get the same results. */ crypto_free_cipher_env(env2); |