mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-09-04 16:45:24 +00:00
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()).
This commit is contained in:
committed by
Ondřej Surý
parent
5ec65ab5d0
commit
29caa6d1f0
@@ -535,7 +535,7 @@ get_cstr_zones(const char *cstr, trpz_rsp_t *trsp, size_t *pnzones) {
|
|||||||
while (tptr != NULL && *tptr != '\0') {
|
while (tptr != NULL && *tptr != '\0') {
|
||||||
tok = strsep(&tptr, ";\n");
|
tok = strsep(&tptr, ";\n");
|
||||||
|
|
||||||
while (isspace(*tok)) {
|
while (isspace((unsigned char)*tok)) {
|
||||||
tok++;
|
tok++;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -547,7 +547,7 @@ get_cstr_zones(const char *cstr, trpz_rsp_t *trsp, size_t *pnzones) {
|
|||||||
|
|
||||||
tok += 5;
|
tok += 5;
|
||||||
|
|
||||||
while (isspace(*tok)) {
|
while (isspace((unsigned char)*tok)) {
|
||||||
tok++;
|
tok++;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -570,7 +570,8 @@ get_cstr_zones(const char *cstr, trpz_rsp_t *trsp, size_t *pnzones) {
|
|||||||
qend = tok;
|
qend = tok;
|
||||||
}
|
}
|
||||||
|
|
||||||
while (*qend != '\0' && !isspace(*qend)) {
|
while (*qend != '\0' && !isspace((unsigned char)*qend))
|
||||||
|
{
|
||||||
qend++;
|
qend++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1147,7 +1147,7 @@ sanity_check_data_file(const char *fname, char **errp) {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
while (*lptr && !isspace(*lptr)) {
|
while (*lptr && !isspace((unsigned char)*lptr)) {
|
||||||
lptr++;
|
lptr++;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1171,7 +1171,7 @@ sanity_check_data_file(const char *fname, char **errp) {
|
|||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
while (isspace(*lptr)) {
|
while (isspace((unsigned char)*lptr)) {
|
||||||
lptr++;
|
lptr++;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1280,7 +1280,7 @@ load_all_updates(const char *fname, trpz_result_t **presults, size_t *pnresults,
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
while (*lptr && !isspace(*lptr)) {
|
while (*lptr && !isspace((unsigned char)*lptr)) {
|
||||||
lptr++;
|
lptr++;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1343,7 +1343,7 @@ load_all_updates(const char *fname, trpz_result_t **presults, size_t *pnresults,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Everything here is an update */
|
/* Everything here is an update */
|
||||||
while (isspace(*lptr)) {
|
while (isspace((unsigned char)*lptr)) {
|
||||||
lptr++;
|
lptr++;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1421,7 +1421,7 @@ wdns_str_to_name(const char *str, uint8_t **pbuf, bool downcase) {
|
|||||||
}
|
}
|
||||||
*data++ = c;
|
*data++ = c;
|
||||||
res++;
|
res++;
|
||||||
} else if (c == '\\' && !isdigit(*p)) {
|
} else if (c == '\\' && !isdigit((unsigned char)*p)) {
|
||||||
/* an escaped character */
|
/* an escaped character */
|
||||||
if (slen <= 0) {
|
if (slen <= 0) {
|
||||||
goto out;
|
goto out;
|
||||||
@@ -1441,7 +1441,9 @@ wdns_str_to_name(const char *str, uint8_t **pbuf, bool downcase) {
|
|||||||
d[2] = *p++;
|
d[2] = *p++;
|
||||||
d[3] = '\0';
|
d[3] = '\0';
|
||||||
slen -= 3;
|
slen -= 3;
|
||||||
if (!isdigit(d[0]) || !isdigit(d[1]) || !isdigit(d[2]))
|
if (!isdigit((unsigned char)d[0]) ||
|
||||||
|
!isdigit((unsigned char)d[1]) ||
|
||||||
|
!isdigit((unsigned char)d[2]))
|
||||||
{
|
{
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
@@ -474,7 +474,7 @@ get_parameter_value(const char *input, const char *key) {
|
|||||||
|
|
||||||
for (i = 0; i < 255; i++) {
|
for (i = 0; i < 255; i++) {
|
||||||
value[i] = keystart[keylen + 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';
|
value[i] = '\0';
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@@ -333,8 +333,10 @@ value_match(const struct phr_header *header, const char *match) {
|
|||||||
limit = header->value_len - match_len + 1;
|
limit = header->value_len - match_len + 1;
|
||||||
|
|
||||||
for (size_t i = 0; i < limit; i++) {
|
for (size_t i = 0; i < limit; i++) {
|
||||||
if (isspace(header->value[i])) {
|
if (isspace((unsigned char)header->value[i])) {
|
||||||
while (i < limit && isspace(header->value[i])) {
|
while (i < limit &&
|
||||||
|
isspace((unsigned char)header->value[i]))
|
||||||
|
{
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
|
Reference in New Issue
Block a user