tfix buffer overflows on very big inputs (more than 4096 bytes) - vote - simple… | |
git clone git://src.adamsgaard.dk/vote | |
Log | |
Files | |
Refs | |
README | |
LICENSE | |
--- | |
commit bdffc606de2cab60a78349fe387c97a0a0220e38 | |
parent 542105db6abb6ea8f555fe1c60343aebb85dd91b | |
Author: Hiltjo Posthuma <[email protected]> | |
Date: Sun, 4 Oct 2020 15:47:23 +0200 | |
fix buffer overflows on very big inputs (more than 4096 bytes) | |
Signed-off-by: Anders Damsgaard <[email protected]> | |
Diffstat: | |
M vote.c | 4 ++-- | |
1 file changed, 2 insertions(+), 2 deletions(-) | |
--- | |
diff --git a/vote.c b/vote.c | |
t@@ -109,7 +109,7 @@ print_poll_line(char *line, size_t *i, int intable, int vo… | |
{ | |
size_t c; | |
- if (sscanf(line, "%ld\t%s", &c, options) == 2) { | |
+ if (sscanf(line, "%ld\t%4095s", &c, options) == 2) { | |
if (!intable) { | |
puts("</p>\n<table>"); | |
if (vote) { | |
t@@ -316,7 +316,7 @@ increment_option(char *poll, size_t n) | |
} | |
while ((linelen = getline(&line, &linesize, fp)) != -1) { | |
- if (sscanf(line, "%ld\t%s", &v, options) != 2) | |
+ if (sscanf(line, "%ld\t%4095s", &v, options) != 2) | |
fputs(line, fp_tmp); | |
else { | |
if (++lineno == n) |