> ***************************************************
> issue:
> extra warnings in compilation of ca.c and gost_pmeth
> 
> solution:
> convert the type to unsigned int before "uppering"

This actually goes beyond just warning. toupper accepts 'int' as
argument and if you pass 'char' from upper half of ASCII table, it will
be passed sign-expanded, and if you pass 'unsigned char', then it will
be passed zero-expanded. What it right? Solaris manual page says:

The  toupper() function has as a domain a type int, the value of which
is representable as an unsigned char or the value of EOF.

Same wording can be found in earlier Linux. Later Linux says "if c is
not an unsigned char value or EOF, the behaviour is undefined." I don't
really understand what does "having as a domain a type int" mean
exactly, but char's sign expansion can be significant. And it seems that
it's not possibility, but a fact. At the very least Solaris *fails* to
convert sign-extended chars to upper case, but manages to convert
zero-extended chars, i.e. characters from upper half of ASCII table
valid in current locale context.

This means that *formally* speaking one should sanitize all references
to toupper/lower/isalpha and alike, not just fix mentioned warnings...


______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
Development Mailing List                       [email protected]
Automated List Manager                           [email protected]

Reply via email to