From e396da26963981db8aacc5b23bee2a7e76f58d35 Mon Sep 17 00:00:00 2001 From: Vladimir Dubrovin <3proxy@3proxy.ru> Date: Wed, 28 Oct 2026 12:01:35 +0300 Subject: [PATCH] StringsPlugin: a line's end cut off without reading past it load_string() put a NUL where a line read from the file had its CR or LF, and stepped over it as well as over the character after: past the line's NUL terminator, into what was left in the buffer from longer lines before, or past its end, writing NULs wherever it found CR or LF. The line is cut at its first CR or LF instead. Co-Authored-By: Claude Opus 5.5 --- src/plugins/StringsPlugin/StringsPlugin.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/src/plugins/StringsPlugin/StringsPlugin.c b/src/plugins/StringsPlugin/StringsPlugin.c index d066df4..f93a88e 100644 --- a/src/plugins/StringsPlugin/StringsPlugin.c +++ b/src/plugins/StringsPlugin/StringsPlugin.c @@ -61,14 +61,9 @@ char **load_string(FILE *f,int max_count_str, int *countloadstr, if (strstr(tmpbuf1,"[end]")==NULL) { - /* find and replace \n \r*/ - rstr = tmpbuf1; - while (*rstr!='\0') - { - if (*rstr=='\r' || *rstr=='\n' ) - { *rstr='\0'; rstr++; } - rstr++; - } + /* the line's end cut off: what the file says with \n is what is + sent */ + tmpbuf1[strcspn(tmpbuf1, "\r\n")] = '\0'; while ((rstr=strstr(tmpbuf1,"\\n"))) {