From 0b4d1f900045cc8dc02cd7dd111faee52a332504 Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Wed, 15 Nov 2017 22:30:17 +0100 Subject: Fix buffer overflow MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- common.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/common.c b/common.c index 9ef98f8..4fc2cce 100644 --- a/common.c +++ b/common.c @@ -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 <= ' ') -- cgit v1.2.3-70-g09d2