src/scanner.c

changeset 76
d11c154e33e1
parent 66
be2084398c37
--- a/src/scanner.c	Sun Nov 10 13:09:54 2024 +0100
+++ b/src/scanner.c	Sun Nov 10 13:54:17 2024 +0100
@@ -236,7 +236,7 @@
         bfile = false;
         bfile_reset(settings->bfileHeuristics);
         regex_parser_reset(settings->regex);
-        char line_buffer[MAX_LINELENGTH];
+        char line_buffer[MAX_LINELENGTH + 1];
         unsigned line_buffer_pos = 0;
 
         FILE *file = fopen(filelist->filename, "r");
@@ -279,7 +279,7 @@
                 line_buffer[line_buffer_pos] = (char) a;
                 line_buffer_pos++;
               } else {
-                line_buffer[line_buffer_pos - 1] = 0;
+                line_buffer[line_buffer_pos] = 0;
                 settings->confusing_lnlen = true;
               }
             }

mercurial