[Bug 377] New: Reduce compiler warnings. Use unsigned args to the ctype.h is*() macros.
Tony Finch
dot at dotat.at
Sat Aug 3 00:06:13 EST 2002
Florian Weimer <Weimer at CERT.Uni-Stuttgart.DE> wrote:
>bugzilla-daemon at mindrot.org writes:
>
>> Given the possibility of characters outside of the 0 thru 0x7f range
>> and the implementation of the is*() macros as using an index into an
>> array, negative arguments could lead to unexpected behavior.
>>
>> log:
>> * canohost.c (get_remote_hostname): Argument to macro
>> isupper() should be unsigned.
>
>This is not quite correct on compilers with signed chars. Arguments
>for the is* functions are indeed ints. (I think the warnings are
>bogus.)
They are unsigned chars converted to ints or EOF, i.e. the same type
and range as the result of getc() etc. Passing chars to the is*
macros is wrong because if char is signed you end up with an out-
of range negative argument. The warning is right, because indexing
an array with a char is open to the same error.
Tony.
--
f.a.n.finch <dot at dotat.at> http://dotat.at/
BAILEY: MAINLY EASTERLY 4 OR 5. FAIR. MODERATE OR GOOD.
More information about the openssh-unix-dev
mailing list