Explicitly cast chars to unsigned chars for <ctype.h> functions
Apply the semantic patch to catch all the places where we pass 'char' to
the <ctype.h> family of functions (isalpha() and friends, toupper(),
tolower()).
(cherry picked from commit 29caa6d1f0)
This commit is contained in:
@@ -474,7 +474,7 @@ get_parameter_value(const char *input, const char *key) {
|
||||
|
||||
for (i = 0; i < 255; i++) {
|
||||
value[i] = keystart[keylen + i];
|
||||
if (isspace(value[i]) || value[i] == '\0') {
|
||||
if (isspace((unsigned char)value[i]) || value[i] == '\0') {
|
||||
value[i] = '\0';
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -2057,7 +2057,7 @@ decvalue(char value) {
|
||||
* isascii() is valid for full range of int values, no need to
|
||||
* mask or cast.
|
||||
*/
|
||||
if (!isascii(value)) {
|
||||
if (!isascii((unsigned char)value)) {
|
||||
return (-1);
|
||||
}
|
||||
if ((s = strchr(decdigits, value)) == NULL) {
|
||||
|
||||
@@ -569,10 +569,14 @@ isc_file_isabsolute(const char *filename) {
|
||||
if ((filename[0] == '\\') && (filename[1] == '\\')) {
|
||||
return (true);
|
||||
}
|
||||
if (isalpha(filename[0]) && filename[1] == ':' && filename[2] == '\\') {
|
||||
if (isalpha((unsigned char)filename[0]) && filename[1] == ':' &&
|
||||
filename[2] == '\\')
|
||||
{
|
||||
return (true);
|
||||
}
|
||||
if (isalpha(filename[0]) && filename[1] == ':' && filename[2] == '/') {
|
||||
if (isalpha((unsigned char)filename[0]) && filename[1] == ':' &&
|
||||
filename[2] == '/')
|
||||
{
|
||||
return (true);
|
||||
}
|
||||
return (false);
|
||||
|
||||
@@ -70,7 +70,7 @@ is_ntfs(const char *file) {
|
||||
* Look for c:\path\... style, c:/path/... or \\computer\shar\path...
|
||||
* the UNC style file specs
|
||||
*/
|
||||
if (isalpha(filename[0]) && filename[1] == ':' &&
|
||||
if (isalpha((unsigned char)filename[0]) && filename[1] == ':' &&
|
||||
(filename[2] == '\\' || filename[2] == '/'))
|
||||
{
|
||||
/* Copy 'c:\' or 'c:/' and NUL terminate. */
|
||||
|
||||
Reference in New Issue
Block a user