diff options
author | Mattias Andrée <maandree@operamail.com> | 2014-02-11 17:09:55 +0100 |
---|---|---|
committer | Mattias Andrée <maandree@operamail.com> | 2014-02-11 17:09:55 +0100 |
commit | e9fe6f2c520c7116316bc42be35338f289a4c19c (patch) | |
tree | c721f1a2a043323c36b48ce6a293c7e496dd3b50 /c | |
parent | c version: make the state accessible (diff) | |
download | sha3sum-e9fe6f2c520c7116316bc42be35338f289a4c19c.tar.gz sha3sum-e9fe6f2c520c7116316bc42be35338f289a4c19c.tar.bz2 sha3sum-e9fe6f2c520c7116316bc42be35338f289a4c19c.tar.xz |
forgot to wipe at realloc
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to 'c')
-rw-r--r-- | c/sha3.c | 4 |
1 files changed, 4 insertions, 0 deletions
@@ -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_; } |