diff options
| author | David Lamparter <equinox@diac24.net> | 2019-08-06 16:54:52 +0200 |
|---|---|---|
| committer | David Lamparter <equinox@diac24.net> | 2019-08-06 16:54:52 +0200 |
| commit | fefa5e0ff5af98d8258987e21422243926ee2b3c (patch) | |
| tree | 05ad830d4a48048156689b15a5c84df124964cb6 /lib/command_match.c | |
| parent | 7040d52aafca16fb0048c1712a919d8209c54dc9 (diff) | |
*: fix ctype (isalpha & co.) casts
The correct cast for these is (unsigned char), because "char" could be
signed and thus have some negative value. isalpha & co. expect an int
arg that is positive, i.e. 0-255. So we need to cast to (unsigned char)
when calling any of these.
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
Diffstat (limited to 'lib/command_match.c')
| -rw-r--r-- | lib/command_match.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/command_match.c b/lib/command_match.c index 9456e1585a..26d763849d 100644 --- a/lib/command_match.c +++ b/lib/command_match.c @@ -714,7 +714,7 @@ static enum match_type match_ipv4(const char *str) dots++; break; } - if (!isdigit((int)*str)) + if (!isdigit((unsigned char)*str)) return no_match; str++; @@ -765,7 +765,7 @@ static enum match_type match_ipv4_prefix(const char *str) break; } - if (!isdigit((int)*str)) + if (!isdigit((unsigned char)*str)) return no_match; str++; @@ -797,7 +797,7 @@ static enum match_type match_ipv4_prefix(const char *str) sp = str; while (*str != '\0') { - if (!isdigit((int)*str)) + if (!isdigit((unsigned char)*str)) return no_match; str++; |
