https://gitlab.synchro.net/main/sbbs/-/commit/ff50c3b984c84598374d651f
Modified Files:
src/xpdev/dirwrap.c gen_defs.h genwrap.c ini_file.c
Log Message:
xpdev: never pass a negative char to tolower() or toupper()
strlwr() and strupr(), and the other callers in genwrap.c, dirwrap.c
and ini_file.c, handed a plain char to tolower()/toupper(). Where char
is signed, a byte of 0x80 or more is a negative value, for which those functions are not defined; on NetBSD they crash.
That is the segmentation fault jsexec has had on netbsd-amd64 in the
mailbox tests of every CI run since those tests began saving messages
with non-ASCII subjects: MsgBase.save_msg() -> smb_subject_crc() ->
strlwr(), as the backtrace from the core file shows.
gen_defs.h gains TO_UPPERCASE() and TO_LOWERCASE(), which cast their
argument to unsigned char as the IS_ALPHA() family beside them already
does for the classification functions, and each of those 16 calls uses
them. For ASCII nothing changes.
Built with GCC on Linux, where the old code did not crash; the fix is
confirmed only by reading, until the NetBSD job runs.
Co-Authored-By: Claude Fable 5.2 <
noreply@anthropic.com>