strcasecmp and strncasecmp returned the folded unsigned-byte difference,
following FreeBSD 11.4's strcasecmp.c (#3966, #9642). The libc.prx bundled
with eleven titles returns -1, 0 or 1, the sign of that difference; both
functions now do the same, and the byte-pair tests expect it.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
guest_strings checked the bounds-checked and BSD string functions but not
the plain C ones. It now checks strcmp, strncmp and strcoll by sign,
strlen, strcpy and strcat return values, strncpy zero padding and its
unterminated truncation, strstr with an empty needle, strspn, bcmp and
bzero.
CheckSscanfS was empty on Windows because its whole body sat under
#ifndef _WIN32. The 13 checks pass there, so they run on every host.
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
strrchr passed its int argument to the host strrchr unchanged. On Windows the
host compares it with the signed char bytes of the string, so a byte of 0x80 to
0xFF passed as an unsigned value (0xE9) or a value above 255 (0x12F) was not
found, where FreeBSD converts the argument to char first.
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
FreeBSD returns the difference of the lowercased bytes where the strings
differ, including where one of them ends. The guest wrappers returned the raw
difference of the terminator and the unfolded byte, so strcasecmp("ab", "A")
gave 66 instead of 98.
Cover 16 paths with long leaves, exact-fit and overlong directory results, repeated separators, input preservation and guest errno. The regression reports 12 failures on unchanged main and passes with the accompanying fix.
AI-assisted: yes
FreeBSD's memset_s returns EINVAL for every constraint violation and writes nothing when smax or n exceeds RSIZE_MAX. The guest returned ERANGE when n exceeded smax and wrote up to min(n, smax) bytes even when smax or n exceeded RSIZE_MAX.
(cherry picked from commit bf08837cf929e40f1b646df82e140a33076d5587)
Split at the first delimiter like FreeBSD's strsep: empty fields are
returned, and the cursor becomes null after the last token.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Format the address bytes in network order as dotted decimal into a
per-thread buffer, like FreeBSD's inet_ntoa returns its static one.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
PICO-8 for PS5 (PPSA99808) stops at start-up on the unresolved import
a7ToDPsIQrc from libSceLibcInternal. The parser follows FreeBSD's inet_aton
(lib/libc/inet/inet_addr.c): one to four parts in decimal, octal or hex, the
last part filling the remaining bytes, input ending at a NUL or whitespace,
and a null address only validating.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
PICO-8 for PS5 (PPSA99808) imports stpcpy from libSceLibcInternal, one
of the absent imports #1578 lists for it. POSIX defines it as strcpy
that returns a pointer to the terminating null of the copy.
A %s or %[ field was treated as overflowed whenever the next input
character could continue it, even when the field width from the format
ended the read. sscanf_s("abcdef", "%3s", buf, 10) returned 0 with an
empty buffer instead of 1 with "abc". Run the overflow check only when
the buffer capacity reduced the width.
The DQbtGaBKlaw import was a throwing stub (libcCyberUnknown17). It is
the NID of "strnlen_s", which C11 K.3.7.4.4 defines as strnlen that
returns 0 for a null pointer.
The removed stub comment from #358 described its call site as
float -> float, which contradicts the hash-verified name; #492 left the
stub untouched for that reason.