diff options
author | Todd C. Miller <millert@cvs.openbsd.org> | 2020-02-24 23:54:29 +0000 |
---|---|---|
committer | Todd C. Miller <millert@cvs.openbsd.org> | 2020-02-24 23:54:29 +0000 |
commit | afb887040b252f643dfe5ae0d34983fe47fc218b (patch) | |
tree | 2b127243fe04a739bd802f0902de2efce458a763 /usr.sbin | |
parent | 772aedebf9a352b576c7b62ab2d69a9bc5e5998f (diff) |
Cast argument of ctype(3) macros to unsigned char, not int.
Similar to a diff from Hiltjo Posthum. OK jung@ deraadt@
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/smtpd/mta_session.c | 21 | ||||
-rw-r--r-- | usr.sbin/smtpd/parse.y | 4 | ||||
-rw-r--r-- | usr.sbin/smtpd/smtp_client.c | 9 | ||||
-rw-r--r-- | usr.sbin/smtpd/util.c | 6 |
4 files changed, 20 insertions, 20 deletions
diff --git a/usr.sbin/smtpd/mta_session.c b/usr.sbin/smtpd/mta_session.c index 3f85566402b..e109e662a10 100644 --- a/usr.sbin/smtpd/mta_session.c +++ b/usr.sbin/smtpd/mta_session.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mta_session.c,v 1.132 2020/02/24 16:16:07 millert Exp $ */ +/* $OpenBSD: mta_session.c,v 1.133 2020/02/24 23:54:27 millert Exp $ */ /* * Copyright (c) 2008 Pierre-Yves Ritschard <pyr@openbsd.org> @@ -1295,13 +1295,12 @@ mta_io(struct io *io, int evt, void *arg) if (s->replybuf[0] == '\0') (void)strlcat(s->replybuf, line, sizeof s->replybuf); else if (len > 4) { - line = line + 4; - if (isdigit((int)*line) && *(line + 1) == '.' && - isdigit((int)*line+2) && *(line + 3) == '.' && - isdigit((int)*line+4) && isspace((int)*(line + 5))) - (void)strlcat(s->replybuf, line+5, sizeof s->replybuf); - else - (void)strlcat(s->replybuf, line, sizeof s->replybuf); + p = line + 4; + if (isdigit((unsigned char)p[0]) && p[1] == '.' && + isdigit((unsigned char)p[2]) && p[3] == '.' && + isdigit((unsigned char)p[4]) && isspace((unsigned char)p[5])) + p += 5; + (void)strlcat(s->replybuf, p, sizeof s->replybuf); } goto nextline; } @@ -1313,9 +1312,9 @@ mta_io(struct io *io, int evt, void *arg) (void)strlcat(s->replybuf, line, sizeof s->replybuf); else if (len > 4) { p = line + 4; - if (isdigit((int)*p) && *(p + 1) == '.' && - isdigit((int)*p+2) && *(p + 3) == '.' && - isdigit((int)*p+4) && isspace((int)*(p + 5))) + if (isdigit((unsigned char)p[0]) && p[1] == '.' && + isdigit((unsigned char)p[2]) && p[3] == '.' && + isdigit((unsigned char)p[4]) && isspace((unsigned char)p[5])) p += 5; if (strlcat(s->replybuf, p, sizeof s->replybuf) >= sizeof s->replybuf) (void)strlcpy(s->replybuf, line, sizeof s->replybuf); diff --git a/usr.sbin/smtpd/parse.y b/usr.sbin/smtpd/parse.y index e3a02430be3..4d187f7a42e 100644 --- a/usr.sbin/smtpd/parse.y +++ b/usr.sbin/smtpd/parse.y @@ -1,4 +1,4 @@ -/* $OpenBSD: parse.y,v 1.276 2020/02/03 15:41:22 gilles Exp $ */ +/* $OpenBSD: parse.y,v 1.277 2020/02/24 23:54:27 millert Exp $ */ /* * Copyright (c) 2008 Gilles Chehade <gilles@poolp.org> @@ -529,7 +529,7 @@ SMTP LIMIT limits_smtp free($3); YYERROR; } - if (isspace((int)*$3) || !isprint((int)*$3) || *$3== '@') { + if (isspace((unsigned char)*$3) || !isprint((unsigned char)*$3) || *$3 == '@') { yyerror("sub-addr-delim uses invalid character"); free($3); YYERROR; diff --git a/usr.sbin/smtpd/smtp_client.c b/usr.sbin/smtpd/smtp_client.c index 22e798900cf..528f48b7f07 100644 --- a/usr.sbin/smtpd/smtp_client.c +++ b/usr.sbin/smtpd/smtp_client.c @@ -1,4 +1,4 @@ -/* $OpenBSD: smtp_client.c,v 1.12 2019/09/10 12:08:26 eric Exp $ */ +/* $OpenBSD: smtp_client.c,v 1.13 2020/02/24 23:54:27 millert Exp $ */ /* * Copyright (c) 2018 Eric Faurot <eric@openbsd.org> @@ -779,9 +779,10 @@ smtp_client_replycat(struct smtp_client *proto, const char *line) line += 3; if (line[0]) { line += 1; - if (isdigit((int)line[0]) && line[1] == '.' && - isdigit((int)line[2]) && line[3] == '.' && - isdigit((int)line[4]) && isspace((int)line[5])) + if (isdigit((unsigned char)line[0]) && line[1] == '.' && + isdigit((unsigned char)line[2]) && line[3] == '.' && + isdigit((unsigned char)line[4]) && + isspace((unsigned char)line[5])) line += 5; } } else diff --git a/usr.sbin/smtpd/util.c b/usr.sbin/smtpd/util.c index f59ad1e4690..fce97ee764e 100644 --- a/usr.sbin/smtpd/util.c +++ b/usr.sbin/smtpd/util.c @@ -1,4 +1,4 @@ -/* $OpenBSD: util.c,v 1.150 2019/10/03 04:49:12 gilles Exp $ */ +/* $OpenBSD: util.c,v 1.151 2020/02/24 23:54:28 millert Exp $ */ /* * Copyright (c) 2000,2001 Markus Friedl. All rights reserved. @@ -462,7 +462,7 @@ valid_domainpart(const char *s) if (strlcpy(domain, p, sizeof domain) >= sizeof domain) return 0; - c = strchr(domain, (int)']'); + c = strchr(domain, ']'); if (!c || c[1] != '\0') return 0; @@ -489,7 +489,7 @@ valid_domainpart(const char *s) return res_hnok(s); } -#define LABELCHR(c) ((c) == '-' || (c) == '_' || isalpha((int)(c)) || isdigit((int)(c))) +#define LABELCHR(c) ((c) == '-' || (c) == '_' || isalpha((unsigned char)(c)) || isdigit((unsigned char)(c))) #define LABELMAX 63 #define DNAMEMAX 253 |