Subject: bug#73307: Fix ctype(3) usage

From: Thomas Klausner <[email-masked]>
Date: Tue, 17 Sep 2024 13:55:59 +0200

On Tue, Sep 17, 2024 at 02:52:20PM +0300, Eli Zaretskii wrote:
> Thanks.  However, I'm not sure this is the right fix, the function is
> defined with argument type of 'int'.  Paul, any comments?

That is exactly the problem.

If you pass a 'signed char' below -1, it gets converted to the same
integer value, also a negative number below -1, and you end up passing
an invalid argument to the function. The function is defined to only
accept EOF and non-negative values in the range of 'unsigned char'.

-1 is only special because that's usually the value of EOF.
 Thomas