aboutsummaryrefslogtreecommitdiffstats
path: root/c/sha3.c
diff options
context:
space:
mode:
authorMattias Andrée <maandree@operamail.com>2014-02-11 17:09:55 +0100
committerMattias Andrée <maandree@operamail.com>2014-02-11 17:09:55 +0100
commite9fe6f2c520c7116316bc42be35338f289a4c19c (patch)
treec721f1a2a043323c36b48ce6a293c7e496dd3b50 /c/sha3.c
parentc version: make the state accessible (diff)
downloadsha3sum-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 '')
-rw-r--r--c/sha3.c4
1 files changed, 4 insertions, 0 deletions
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_;
}