Fix a heap overrun in test_decode_plaintext

This commit is contained in:
Nick Mathewson 2016-11-04 14:28:19 -04:00
parent d16b4b3e48
commit 1a03edefba

View File

@ -987,6 +987,7 @@ test_decode_plaintext(void *arg)
tt_int_op(HS_DESC_MAX_LEN, <, big);
char *plaintext = tor_malloc_zero(big);
memset(plaintext, 'a', big);
plaintext[big - 1] = '\0';
ret = hs_desc_decode_plaintext(plaintext, &desc_plaintext);
tor_free(plaintext);
tt_int_op(ret, OP_EQ, -1);