# HG changeset patch # User Mike Becker # Date 1731243257 -3600 # Node ID d11c154e33e10261dc4e2b19f70a83eb13005da1 # Parent ba4bc497c6a77a67500c4ccf564f3a5a85419ce8 fix zero-terminator written to wrong position when encountering too long lines - fixes #490 diff -r ba4bc497c6a7 -r d11c154e33e1 Makefile --- a/Makefile Sun Nov 10 13:09:54 2024 +0100 +++ b/Makefile Sun Nov 10 13:54:17 2024 +0100 @@ -21,7 +21,7 @@ # OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -VERSION=1.4.1 +VERSION=1.4.2 all: build config.mk FORCE @cd src && $(MAKE) VERSION=$(VERSION) diff -r ba4bc497c6a7 -r d11c154e33e1 src/regex_parser.h --- a/src/regex_parser.h Sun Nov 10 13:09:54 2024 +0100 +++ b/src/regex_parser.h Sun Nov 10 13:54:17 2024 +0100 @@ -27,7 +27,7 @@ #ifndef REGEX_PARSER_H_ #define REGEX_PARSER_H_ -#define MAX_LINELENGTH 4096u +#define MAX_LINELENGTH 4095u #include #include diff -r ba4bc497c6a7 -r d11c154e33e1 src/scanner.c --- 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; } } diff -r ba4bc497c6a7 -r d11c154e33e1 vs/cline.vcxproj --- a/vs/cline.vcxproj Sun Nov 10 13:09:54 2024 +0100 +++ b/vs/cline.vcxproj Sun Nov 10 13:54:17 2024 +0100 @@ -77,7 +77,7 @@ Level3 true - VERSION="1.4.1-win64-debug";_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + VERSION="1.4.2-win64-debug";_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) true stdc11 $(ProjectDir)include\;%(AdditionalIncludeDirectories) @@ -93,7 +93,7 @@ true true true - VERSION="1.4.1-win64";NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + VERSION="1.4.2-win64";NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) true stdc11 CompileAsC