From e9fe6f2c520c7116316bc42be35338f289a4c19c Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Tue, 11 Feb 2014 17:09:55 +0100 Subject: forgot to wipe at realloc MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- c/sha3.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'c') diff --git a/c/sha3.c b/c/sha3.c index 6c35267..a06cd38 100644 --- a/c/sha3.c +++ b/c/sha3.c @@ -598,6 +598,8 @@ extern void sha3_update(byte* restrict msg, long msglen) long mlen_ = mlen; char* M_ = (byte*)malloc(mlen = (mlen + msglen) << 1); sha3_arraycopy(M, 0, M_, 0, mlen_); + for (i = 0; i < mlen_; i++) + *(M + i) = 0; free(M); M = M_; } @@ -680,6 +682,8 @@ extern byte* sha3_digest(byte* restrict msg, long msglen, boolean withReturn) long mlen_ = mlen; char* M_ = (byte*)malloc(mlen += msglen); sha3_arraycopy(M, 0, M_, 0, mlen_); + for (i = 0; i < mlen_; i++) + *(M + i) = 0; free(M); M = M_; } -- cgit v1.2.3-70-g09d2