diff options
author | Nick Mathewson <nickm@torproject.org> | 2017-11-06 12:59:23 -0500 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2017-11-06 12:59:23 -0500 |
commit | 7d767706ef9d46738028ed3990d638283929fd85 (patch) | |
tree | 60447fe4712b48fb0a2f9f6a8295e8cd11b70951 /src/or | |
parent | bebdd910580ba13de02743ecfedb34bd2b2842a4 (diff) | |
parent | 5240afa713581a0bbba64547e00107a9cbf17f21 (diff) | |
download | tor-7d767706ef9d46738028ed3990d638283929fd85.tar.gz tor-7d767706ef9d46738028ed3990d638283929fd85.zip |
Merge branch 'bug24150_032_squashed' into maint-0.3.2
Diffstat (limited to 'src/or')
-rw-r--r-- | src/or/hs_descriptor.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/or/hs_descriptor.c b/src/or/hs_descriptor.c index a8ff3471c7..1708866944 100644 --- a/src/or/hs_descriptor.c +++ b/src/or/hs_descriptor.c @@ -1302,7 +1302,11 @@ encrypted_data_length_is_valid(size_t len) * <b>encrypted_blob_size</b>. Use the descriptor object <b>desc</b> to * generate the right decryption keys; set <b>decrypted_out</b> to the * plaintext. If <b>is_superencrypted_layer</b> is set, this is the outter - * encrypted layer of the descriptor. */ + * encrypted layer of the descriptor. + * + * On any error case, including an empty output, return 0 and set + * *<b>decrypted_out</b> to NULL. + */ MOCK_IMPL(STATIC size_t, decrypt_desc_layer,(const hs_descriptor_t *desc, const uint8_t *encrypted_blob, @@ -1382,6 +1386,11 @@ decrypt_desc_layer,(const hs_descriptor_t *desc, } } + if (result_len == 0) { + /* Treat this as an error, so that somebody will free the output. */ + goto err; + } + /* Make sure to NUL terminate the string. */ decrypted[encrypted_len] = '\0'; *decrypted_out = (char *) decrypted; |