aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--changes/bug44105
-rw-r--r--src/or/routerparse.c5
2 files changed, 10 insertions, 0 deletions
diff --git a/changes/bug4410 b/changes/bug4410
new file mode 100644
index 0000000000..f42893adf4
--- /dev/null
+++ b/changes/bug4410
@@ -0,0 +1,5 @@
+ o Major bugfixes:
+ - Correctly sanity-check that we don't underflow on a memory allocation
+ for introduction point decryption. Bug discovered by Dan Rosenberg.
+ Fixes bug 4410; bugfix on 0.2.1.5-alpha.
+
diff --git a/src/or/routerparse.c b/src/or/routerparse.c
index e8b2dd7d2b..4ea7b964cf 100644
--- a/src/or/routerparse.c
+++ b/src/or/routerparse.c
@@ -4886,6 +4886,11 @@ rend_decrypt_introduction_points(char **ipos_decrypted,
crypto_cipher_env_t *cipher;
char *dec;
int declen;
+ if (ipos_encrypted_size < CIPHER_IV_LEN + 2) {
+ log_warn(LD_REND, "Size of encrypted introduction points is too "
+ "small.");
+ return -1;
+ }
dec = tor_malloc_zero(ipos_encrypted_size - CIPHER_IV_LEN - 1);
cipher = crypto_create_init_cipher(descriptor_cookie, 0);
declen = crypto_cipher_decrypt_with_iv(cipher, dec,