tfix buffer overflows on very big inputs (more than 4096 bytes) - vote - simple cgi voting system for web and gopher
 (HTM) git clone git://src.adamsgaard.dk/vote
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) README
 (DIR) LICENSE
       ---
 (DIR) commit bdffc606de2cab60a78349fe387c97a0a0220e38
 (DIR) parent 542105db6abb6ea8f555fe1c60343aebb85dd91b
 (HTM) Author: Hiltjo Posthuma <hiltjo@codemadness.org>
       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 <anders@adamsgaard.dk>
       
       Diffstat:
         M vote.c                              |       4 ++--
       
       1 file changed, 2 insertions(+), 2 deletions(-)
       ---
 (DIR) diff --git a/vote.c b/vote.c
       t@@ -109,7 +109,7 @@ print_poll_line(char *line, size_t *i, int intable, int vote)
        {
                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)