ENC: fix possible memory error
LZ4_compress might add a null-byte, so we have to account for that.
This commit is contained in:
parent
5e849d3d50
commit
03f3901b81
@ -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);
|
||||||
|
Loading…
Reference in New Issue
Block a user