From 03f3901b81cb72d08017fa01c873efa4e092395c Mon Sep 17 00:00:00 2001 From: hasufell Date: Sat, 28 Jun 2014 00:47:47 +0200 Subject: [PATCH] ENC: fix possible memory error LZ4_compress might add a null-byte, so we have to account for that. --- src/ntru_encrypt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ntru_encrypt.c b/src/ntru_encrypt.c index 172c366..ab2fe06 100644 --- a/src/ntru_encrypt.c +++ b/src/ntru_encrypt.c @@ -63,7 +63,7 @@ get_compressed_str(const string *str) if (!str) 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->ptr = ntru_malloc( sizeof(char) * max_output_size);