Re: [PATCH] ctype functions and signedness

2015-11-24 Thread Jeff Law
On 11/16/2015 08:59 AM, Michael McConville wrote: Hi, everyone. While it often (usually?) isn't an issue, passing a signed char to ctype functions is undefined. Here's the CERT entry: https://www.securecoding.cert.org/confluence/x/fAs This means that we need to cast chars to unsigned c

Re: [PATCH] ctype functions and signedness

2015-11-16 Thread Michael McConville
DJ Delorie wrote: > > > --- libiberty/pex-win32.c > > +++ /tmp/cocci-output-25924-3a75ca-pex-win32.c > > @@ -547,8 +547,8 @@ env_compare (const void *a_ptr, const vo > > > >do > > { > > - c1 = (unsigned char) tolower (*a++); > > - c2 = (unsigned char) tolower (*b++); > > +

Re: [PATCH] ctype functions and signedness

2015-11-16 Thread DJ Delorie
> --- libiberty/pex-win32.c > +++ /tmp/cocci-output-25924-3a75ca-pex-win32.c > @@ -547,8 +547,8 @@ env_compare (const void *a_ptr, const vo > >do > { > - c1 = (unsigned char) tolower (*a++); > - c2 = (unsigned char) tolower (*b++); > + c1 = (unsigned char) tolower ((unsig

[PATCH] ctype functions and signedness

2015-11-16 Thread Michael McConville
Hi, everyone. While it often (usually?) isn't an issue, passing a signed char to ctype functions is undefined. Here's the CERT entry: https://www.securecoding.cert.org/confluence/x/fAs This means that we need to cast chars to unsigned char before passing them to one of these functions.