Merge branch '4327-minor-warning-about-ctype-h-function-9.18' into 'bind-9.18'
[9.18] Add semantic patch to explicitly cast chars to unsigned for ctype.h See merge request isc-projects/bind9!8332
This commit is contained in:
4
CHANGES
4
CHANGES
@@ -1,3 +1,7 @@
|
||||
6254. [cleanup] Add semantic patch to do an explicit cast from char
|
||||
to unsigned char in ctype.h class of functions.
|
||||
[GL #4327]
|
||||
|
||||
6252. [test] Python system tests have to be executed by invoking
|
||||
pytest directly. Executing them with the legacy test
|
||||
runner is no longer supported. [GL #4250]
|
||||
|
||||
105
cocci/ctype.spatch
Normal file
105
cocci/ctype.spatch
Normal file
@@ -0,0 +1,105 @@
|
||||
@@
|
||||
char T;
|
||||
@@
|
||||
|
||||
- isalnum(T)
|
||||
+ isalnum((unsigned char)T)
|
||||
|
||||
@@
|
||||
char T;
|
||||
@@
|
||||
|
||||
- isalpha(T)
|
||||
+ isalpha((unsigned char)T)
|
||||
|
||||
@@
|
||||
char T;
|
||||
@@
|
||||
|
||||
- iscntrl(T)
|
||||
+ iscntrl((unsigned char)T)
|
||||
|
||||
@@
|
||||
char T;
|
||||
@@
|
||||
|
||||
- isdigit(T)
|
||||
+ isdigit((unsigned char)T)
|
||||
|
||||
@@
|
||||
char T;
|
||||
@@
|
||||
|
||||
- isgraph(T)
|
||||
+ isgraph((unsigned char)T)
|
||||
|
||||
@@
|
||||
char T;
|
||||
@@
|
||||
|
||||
- islower(T)
|
||||
+ islower((unsigned char)T)
|
||||
|
||||
@@
|
||||
char T;
|
||||
@@
|
||||
|
||||
- isprint(T)
|
||||
+ isprint((unsigned char)T)
|
||||
|
||||
@@
|
||||
char T;
|
||||
@@
|
||||
|
||||
- ispunct(T)
|
||||
+ ispunct((unsigned char)T)
|
||||
|
||||
@@
|
||||
char T;
|
||||
@@
|
||||
|
||||
- isspace(T)
|
||||
+ isspace((unsigned char)T)
|
||||
|
||||
@@
|
||||
char T;
|
||||
@@
|
||||
|
||||
- isupper(T)
|
||||
+ isupper((unsigned char)T)
|
||||
|
||||
@@
|
||||
char T;
|
||||
@@
|
||||
|
||||
- isxdigit(T)
|
||||
+ isxdigit((unsigned char)T)
|
||||
|
||||
@@
|
||||
char T;
|
||||
@@
|
||||
|
||||
- isascii(T)
|
||||
+ isascii((unsigned char)T)
|
||||
|
||||
@@
|
||||
char T;
|
||||
@@
|
||||
|
||||
- isblank(T)
|
||||
+ isblank((unsigned char)T)
|
||||
|
||||
@@
|
||||
char T;
|
||||
@@
|
||||
|
||||
- tolower(T)
|
||||
+ tolower((unsigned char)T)
|
||||
|
||||
@@
|
||||
char T;
|
||||
@@
|
||||
|
||||
- toupper(T)
|
||||
+ toupper((unsigned char)T)
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -2059,7 +2059,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) {
|
||||
|
||||
@@ -340,8 +340,10 @@ value_match(const struct phr_header *header, const char *match) {
|
||||
limit = header->value_len - match_len + 1;
|
||||
|
||||
for (size_t i = 0; i < limit; i++) {
|
||||
if (isspace(header->value[i])) {
|
||||
while (i < limit && isspace(header->value[i])) {
|
||||
if (isspace((unsigned char)header->value[i])) {
|
||||
while (i < limit &&
|
||||
isspace((unsigned char)header->value[i]))
|
||||
{
|
||||
i++;
|
||||
}
|
||||
continue;
|
||||
|
||||
Reference in New Issue
Block a user