From 9be415b731a34c3a98c2a954bc29c1e04a9f48cf 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 (cherry picked from commit e396da26963981db8aacc5b23bee2a7e76f58d35) --- 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 14d8507..cf695e7 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"))) {