possible bug in 2.0.7 (lib/util_str.c)

Ulrich Windl Ulrich.Windl at rz.uni-regensburg.de
Tue Dec 12 12:32:26 GMT 2000


Viewing some samba diffs I noticed:

        for(i = 0; i < len; i++) {
-               if(isupper(src[i]) ||islower(src[i]) || isdigit(src[i]))
+               int val = (src[i] & 0xff);
+               if(isupper(val) ||islower(val) || isdigit(val))
                        dest[i] = src[i];
                else
                        dest[i] = '_';

AFAIK the ANSI ctype functions are only guaranteed to yield valid 
results if isascii() is true. So maybe write:

               if(isascii(val) &&(isupper(val) ||islower(val) || 
isdigit(val)))

(An Umlaut may make a difference: islower('ö')) 
Regards,
Ulrich





More information about the samba mailing list