diff options
author | Mattias Andrée <maandree@kth.se> | 2017-11-15 22:30:17 +0100 |
---|---|---|
committer | Mattias Andrée <maandree@kth.se> | 2017-11-15 22:30:17 +0100 |
commit | 0b4d1f900045cc8dc02cd7dd111faee52a332504 (patch) | |
tree | fa8aa262846f7df0a9a49998520568d7fcc0b4ff /common.c | |
parent | Fix arg.h (diff) | |
download | sha3sum-0b4d1f900045cc8dc02cd7dd111faee52a332504.tar.gz sha3sum-0b4d1f900045cc8dc02cd7dd111faee52a332504.tar.bz2 sha3sum-0b4d1f900045cc8dc02cd7dd111faee52a332504.tar.xz |
Fix buffer overflow
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to 'common.c')
-rw-r--r-- | common.c | 3 |
1 files changed, 2 insertions, 1 deletions
@@ -148,7 +148,7 @@ generalised_sum_fd_hex(int fd, libkeccak_state_t *restrict state, { ssize_t got; struct stat attr; - size_t blksize = 4096, r = 0, w = 0; + size_t blksize = 4096, r, w; char *restrict chunk; char even = 1, buf = 0, c; @@ -166,6 +166,7 @@ generalised_sum_fd_hex(int fd, libkeccak_state_t *restrict state, return -1; if (!got) break; + r = w = 0; while (r < (size_t)got) { c = chunk[r++]; if (c <= ' ') |