25 Jan 2024 20:36, you wrote to me:
CN>> I think that you have found the source of text corruption problems
CN>> in Smapi/JamNNTPd: it may not be safe to use strcpy that way.
TK> Wow..!
TK> Could it be also the reason why there are no text corruption problems
TK> in my OS/2 version of jamnntpd which is compiled with ancient gcc3 ?
I think so. I don't have those problems when compiling with MinGW for Win32, either. It seems it depends on how each compiler implements the strcpy function.
This may be a possible way to fix the corrupted From field in headers: in nntpserv.c, instead of just removing this line:
strcpy(mimefrom,&mimefrom[6]);
Replace it by:
memmove(mimefrom,mimefrom+6,strlen(mimefrom)-5);
There could also be issues with the Subject field. The next line:
strcpy(mimesubj,&mimesubj[9]);
could be changed to:
memmove(mimesubj,mimesubj+9,strlen(mimesubj)-8);
As for the corruption in the body of messages posted with newsreaders that support flowed text (like Thunderbird), I think it may be fixed by changing this:
strcpy(line,&line[1]);
to this:
memmove(line,line+1,strlen(line));
These patches are for both JamNNTPd and SmapiNNTPd.
Carlos
--- GoldED+/W32-MSVC 1.1.5-b20180707
* Origin: cyberiada (2:341/234.1)
|