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 /bgpd/bgp_community.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 'bgpd/bgp_community.c')
| -rw-r--r-- | bgpd/bgp_community.c | 8 | 
1 files changed, 4 insertions, 4 deletions
diff --git a/bgpd/bgp_community.c b/bgpd/bgp_community.c index 6fc52ff9e0..22d61f702d 100644 --- a/bgpd/bgp_community.c +++ b/bgpd/bgp_community.c @@ -651,7 +651,7 @@ community_gettoken(const char *buf, enum community_token *token, uint32_t *val)  	const char *p = buf;  	/* Skip white space. */ -	while (isspace((int)*p)) +	while (isspace((unsigned char)*p))  		p++;  	/* Check the end of the line. */ @@ -659,7 +659,7 @@ community_gettoken(const char *buf, enum community_token *token, uint32_t *val)  		return NULL;  	/* Well known community string check. */ -	if (isalpha((int)*p)) { +	if (isalpha((unsigned char)*p)) {  		if (strncmp(p, "internet", strlen("internet")) == 0) {  			*val = COMMUNITY_INTERNET;  			*token = community_token_no_export; @@ -770,13 +770,13 @@ community_gettoken(const char *buf, enum community_token *token, uint32_t *val)  	}  	/* Community value. */ -	if (isdigit((int)*p)) { +	if (isdigit((unsigned char)*p)) {  		int separator = 0;  		int digit = 0;  		uint32_t community_low = 0;  		uint32_t community_high = 0; -		while (isdigit((int)*p) || *p == ':') { +		while (isdigit((unsigned char)*p) || *p == ':') {  			if (*p == ':') {  				if (separator) {  					*token = community_token_unknown;  | 
