ENC: fix possible memory error

LZ4_compress might add a null-byte, so we have to account for that.
This commit is contained in:
hasufell 2014-06-28 00:47:47 +02:00
parent 5e849d3d50
commit 03f3901b81
No known key found for this signature in database
GPG Key ID: 220CD1C5BDEED020

View File

@ -63,7 +63,7 @@ get_compressed_str(const string *str)
if (!str) if (!str)
NTRU_ABORT_DEBUG("Unexpected NULL parameters"); NTRU_ABORT_DEBUG("Unexpected NULL parameters");
max_output_size = str->len; max_output_size = str->len + 1;
compressed_str = ntru_malloc(sizeof(string)); compressed_str = ntru_malloc(sizeof(string));
compressed_str->ptr = ntru_malloc( compressed_str->ptr = ntru_malloc(
sizeof(char) * max_output_size); sizeof(char) * max_output_size);