cast ctype(3) function/macro arguments from char to unsigned char
to avoid potential negative subscripting.
This commit is contained in:
@@ -208,10 +208,11 @@ leadingclosebrace:
|
|||||||
/* XXX: handle locale/MBCS comparison, advance by MBCS char width */
|
/* XXX: handle locale/MBCS comparison, advance by MBCS char width */
|
||||||
if ((**string >= *startch) && (**string <= **pattern))
|
if ((**string >= *startch) && (**string <= **pattern))
|
||||||
result = 0;
|
result = 0;
|
||||||
else if (nocase && (isupper(**string) || isupper(*startch)
|
else if (nocase && (isupper((unsigned char)**string) ||
|
||||||
|| isupper(**pattern))
|
isupper((unsigned char)*startch) ||
|
||||||
&& (tolower(**string) >= tolower(*startch))
|
isupper((unsigned char)**pattern))
|
||||||
&& (tolower(**string) <= tolower(**pattern)))
|
&& (tolower((unsigned char)**string) >= tolower((unsigned char)*startch))
|
||||||
|
&& (tolower((unsigned char)**string) <= tolower((unsigned char)**pattern)))
|
||||||
result = 0;
|
result = 0;
|
||||||
|
|
||||||
++*pattern;
|
++*pattern;
|
||||||
@@ -221,8 +222,9 @@ leadingclosebrace:
|
|||||||
/* XXX: handle locale/MBCS comparison, advance by MBCS char width */
|
/* XXX: handle locale/MBCS comparison, advance by MBCS char width */
|
||||||
if ((**string == **pattern))
|
if ((**string == **pattern))
|
||||||
result = 0;
|
result = 0;
|
||||||
else if (nocase && (isupper(**string) || isupper(**pattern))
|
else if (nocase && (isupper((unsigned char)**string) ||
|
||||||
&& (tolower(**string) == tolower(**pattern)))
|
isupper((unsigned char)**pattern))
|
||||||
|
&& (tolower((unsigned char)**string) == tolower((unsigned char)**pattern)))
|
||||||
result = 0;
|
result = 0;
|
||||||
|
|
||||||
++*pattern;
|
++*pattern;
|
||||||
@@ -248,8 +250,8 @@ leadingclosebrace:
|
|||||||
/* XXX: handle locale/MBCS comparison, advance by the MBCS char width */
|
/* XXX: handle locale/MBCS comparison, advance by the MBCS char width */
|
||||||
if (**string == **pattern)
|
if (**string == **pattern)
|
||||||
result = 0;
|
result = 0;
|
||||||
else if (nocase && (isupper(**string) || isupper(**pattern))
|
else if (nocase && (isupper((unsigned char)**string) || isupper((unsigned char)**pattern))
|
||||||
&& (tolower(**string) == tolower(**pattern)))
|
&& (tolower((unsigned char)**string) == tolower((unsigned char)**pattern)))
|
||||||
result = 0;
|
result = 0;
|
||||||
|
|
||||||
/* Refuse to advance over trailing slash or nulls
|
/* Refuse to advance over trailing slash or nulls
|
||||||
|
Reference in New Issue
Block a user