From: Alejandro Colomar Date: Wed, 25 Mar 2026 21:00:40 +0000 (+0100) Subject: Revert "strchriscntrl: reject C1 control bytes (0x80-0x9F)" X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d71f3c33129f329aa3e9e7327edd084118cbc830;p=thirdparty%2Fshadow.git Revert "strchriscntrl: reject C1 control bytes (0x80-0x9F)" C1 control bytes are more complicated than that. They're represented as two bytes in UTF-8. Commit 19d725da, has issues, rejecting otherwise valid UTF-8 multi-byte characters. We could in theory do correct parsing of UTF, possibly parsing the multi-byte sequences, or translating to wchar_t. However, that would complicate the source code well beyond what I'd be comfortable with. Instead, let's revert this, and claim no intention to support UTF-8. If an admin uses a UTF-8 locale while reading /etc/passwd, that's their own fault. Reverts: 19d725da (2026-03-13; "strchriscntrl: reject C1 control bytes (0x80-0x9F)") Fixes: 19d725da (2026-03-13; "strchriscntrl: reject C1 control bytes (0x80-0x9F)") Closes: Reported-by: Mantas Mikulėnas Cc: KhaelK-Praetorian Cc: Tobias Stoeckmann Signed-off-by: Alejandro Colomar --- diff --git a/lib/string/ctype/strchrisascii/strchriscntrl.h b/lib/string/ctype/strchrisascii/strchriscntrl.h index aefa7c9cf..a1eaca371 100644 --- a/lib/string/ctype/strchrisascii/strchriscntrl.h +++ b/lib/string/ctype/strchrisascii/strchriscntrl.h @@ -18,10 +18,7 @@ inline bool strchriscntrl(const char *s); // string character is [:cntrl:] -// Return true if any control character is found in the string. -// Check both C0 (0x00-0x1F, 0x7F) via iscntrl(3) and C1 (0x80-0x9F) -// explicitly, since glibc's iscntrl() does not classify C1 bytes as -// control characters in any locale. +// Return true if any iscntrl(3) character is found in the string. inline bool strchriscntrl(const char *s) { @@ -30,8 +27,6 @@ strchriscntrl(const char *s) if (iscntrl(c)) return true; - if (c >= 0x80 && c <= 0x9F) - return true; } return false;