diff options
-rw-r--r-- | sbin/bioctl/bioctl.c | 4 | ||||
-rw-r--r-- | sbin/disklabel/disklabel.c | 12 | ||||
-rw-r--r-- | sbin/disklabel/editor.c | 10 | ||||
-rw-r--r-- | sbin/dump/dumprmt.c | 4 | ||||
-rw-r--r-- | sbin/fdisk/misc.c | 4 | ||||
-rw-r--r-- | sbin/ifconfig/ifconfig.c | 25 | ||||
-rw-r--r-- | sbin/iked/parse.y | 6 | ||||
-rw-r--r-- | sbin/iked/util.c | 8 | ||||
-rw-r--r-- | sbin/ipsecctl/parse.y | 4 | ||||
-rw-r--r-- | sbin/isakmpd/conf.c | 10 | ||||
-rw-r--r-- | sbin/isakmpd/policy.c | 8 | ||||
-rw-r--r-- | sbin/mount_msdos/mount_msdos.c | 8 | ||||
-rw-r--r-- | sbin/mountd/mountd.c | 10 | ||||
-rw-r--r-- | sbin/newfs/newfs.c | 10 | ||||
-rw-r--r-- | sbin/pfctl/parse.y | 6 | ||||
-rw-r--r-- | sbin/pfctl/pfctl_optimize.c | 4 | ||||
-rw-r--r-- | sbin/pfctl/pfctl_osfp.c | 33 | ||||
-rw-r--r-- | sbin/pfctl/pfctl_parser.c | 8 | ||||
-rw-r--r-- | sbin/pfctl/pfctl_radix.c | 6 | ||||
-rw-r--r-- | sbin/ping/ping.c | 4 | ||||
-rw-r--r-- | sbin/ping6/ping6.c | 7 | ||||
-rw-r--r-- | sbin/scsi/libscsi.c | 20 | ||||
-rw-r--r-- | sbin/shutdown/shutdown.c | 6 | ||||
-rw-r--r-- | sbin/sysctl/sysctl.c | 6 |
24 files changed, 115 insertions, 108 deletions
diff --git a/sbin/bioctl/bioctl.c b/sbin/bioctl/bioctl.c index 3d3191fceb4..8acfa61be6a 100644 --- a/sbin/bioctl/bioctl.c +++ b/sbin/bioctl/bioctl.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bioctl.c,v 1.116 2013/11/11 23:07:52 deraadt Exp $ */ +/* $OpenBSD: bioctl.c,v 1.117 2013/11/22 04:12:46 deraadt Exp $ */ /* * Copyright (c) 2004, 2005 Marco Peereboom @@ -130,7 +130,7 @@ main(int argc, char *argv[]) break; case 'c': /* create */ func |= BIOC_CREATERAID; - if (isdigit(*optarg)) { + if (isdigit((unsigned char)*optarg)) { cr_level = strtonum(optarg, 0, 10, &errstr); if (errstr != NULL) errx(1, "Invalid RAID level"); diff --git a/sbin/disklabel/disklabel.c b/sbin/disklabel/disklabel.c index 6a797cdb7ae..6cf69ab310c 100644 --- a/sbin/disklabel/disklabel.c +++ b/sbin/disklabel/disklabel.c @@ -1,4 +1,4 @@ -/* $OpenBSD: disklabel.c,v 1.190 2013/10/15 20:13:02 bluhm Exp $ */ +/* $OpenBSD: disklabel.c,v 1.191 2013/11/22 04:12:47 deraadt Exp $ */ /* * Copyright (c) 1987, 1993 @@ -182,7 +182,7 @@ main(int argc, char *argv[]) fprintf(stderr, "Valid units are bckmgt\n"); exit(1); } - print_unit = tolower(optarg[0]); + print_unit = tolower((unsigned char)optarg[0]); break; case 'n': donothing++; @@ -521,7 +521,7 @@ makebootarea(char *boot, struct disklabel *dp) p = dkname; else p++; - while (*p && !isdigit(*p)) + while (*p && !isdigit((unsigned char)*p)) *np++ = *p++; *np++ = '\0'; @@ -734,7 +734,7 @@ canonical_unit(struct disklabel *lp, char unit) else unit = 'T'; } - unit = toupper(unit); + unit = toupper((unsigned char)unit); return (unit); } @@ -960,7 +960,7 @@ getnum(char *nptr, u_int64_t min, u_int64_t max, const char **errstr) char *p, c; u_int64_t ret; - for (p = nptr; *p != '\0' && !isspace(*p); p++) + for (p = nptr; *p != '\0' && !isspace((unsigned char)*p); p++) ; c = *p; *p = '\0'; @@ -1224,7 +1224,7 @@ getasciilabel(FILE *f, struct disklabel *lp) pp->p_fstype = cpp - fstypenames; goto gottype; } - if (isdigit(*cp)) + if (isdigit((unsigned char)*cp)) v = GETNUM(pp->p_fstype, cp, 0, &errstr); else v = FSMAXTYPES; diff --git a/sbin/disklabel/editor.c b/sbin/disklabel/editor.c index c9dd8f140c3..434030e7e24 100644 --- a/sbin/disklabel/editor.c +++ b/sbin/disklabel/editor.c @@ -1,4 +1,4 @@ -/* $OpenBSD: editor.c,v 1.277 2013/11/12 04:59:02 deraadt Exp $ */ +/* $OpenBSD: editor.c,v 1.278 2013/11/22 04:12:47 deraadt Exp $ */ /* * Copyright (c) 1997-2000 Todd C. Miller <Todd.Miller@courtesan.com> @@ -370,9 +370,9 @@ editor(int f) arg = getstring("Write new label?", "Write the modified label to disk?", "y"); - } while (arg && tolower(*arg) != 'y' && - tolower(*arg) != 'n'); - if (arg && tolower(*arg) == 'y') { + } while (arg && tolower((unsigned char)*arg) != 'y' && + tolower((unsigned char)*arg) != 'n'); + if (arg && tolower((unsigned char)*arg) == 'y') { if (writelabel(f, bootarea, &newlab) == 0) { newlab = lab; /* lab now has UID info */ goto done; @@ -1182,7 +1182,7 @@ getuint64(struct disklabel *lp, char *prompt, char *helpstring, /* deal with units */ if (buf[0] != '\0' && n > 0) { if ((flags & DO_CONVERSIONS)) { - switch (tolower(buf[n-1])) { + switch (tolower((unsigned char)buf[n-1])) { case 'c': mult = lp->d_secpercyl; diff --git a/sbin/dump/dumprmt.c b/sbin/dump/dumprmt.c index 38664f74bdc..0b6e2ca3172 100644 --- a/sbin/dump/dumprmt.c +++ b/sbin/dump/dumprmt.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dumprmt.c,v 1.27 2013/11/12 04:59:02 deraadt Exp $ */ +/* $OpenBSD: dumprmt.c,v 1.28 2013/11/22 04:12:47 deraadt Exp $ */ /* $NetBSD: dumprmt.c,v 1.17 1997/06/05 16:10:47 mrg Exp $ */ /*- @@ -162,7 +162,7 @@ static int okname(char *cp0) { char *cp; - int c; + unsigned char c; for (cp = cp0; *cp; cp++) { c = *cp; diff --git a/sbin/fdisk/misc.c b/sbin/fdisk/misc.c index 0cdf734d0d6..f3100828d99 100644 --- a/sbin/fdisk/misc.c +++ b/sbin/fdisk/misc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: misc.c,v 1.31 2013/03/21 18:45:58 deraadt Exp $ */ +/* $OpenBSD: misc.c,v 1.32 2013/11/22 04:12:47 deraadt Exp $ */ /* * Copyright (c) 1997 Tobias Weingartner @@ -266,7 +266,7 @@ getuint(disk_t *disk, char *prompt, u_int32_t oval, u_int32_t maxval) } /* deal with units */ - switch (tolower(buf[n-1])) { + switch (tolower((unsigned char)buf[n-1])) { case 'c': unit = 'c'; mult = secpercyl; diff --git a/sbin/ifconfig/ifconfig.c b/sbin/ifconfig/ifconfig.c index a682ee80571..afcf560e8c7 100644 --- a/sbin/ifconfig/ifconfig.c +++ b/sbin/ifconfig/ifconfig.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ifconfig.c,v 1.278 2013/11/21 17:24:34 millert Exp $ */ +/* $OpenBSD: ifconfig.c,v 1.279 2013/11/22 04:12:47 deraadt Exp $ */ /* $NetBSD: ifconfig.c,v 1.40 1997/10/01 02:19:43 enami Exp $ */ /* @@ -800,7 +800,7 @@ getinfo(struct ifreq *ifr, int create) getsock(af); if (s < 0) err(1, "socket"); - if (!isdigit(name[strlen(name) - 1])) + if (!isdigit((unsigned char)name[strlen(name) - 1])) return (-1); /* ignore groups here */ if (ioctl(s, SIOCGIFFLAGS, (caddr_t)ifr) < 0) { int oerrno = errno; @@ -939,7 +939,8 @@ printif(char *ifname, int ifaliases) if ((oname = strdup(ifname)) == NULL) err(1, "strdup"); nlen = strlen(oname); - if (nlen && !isdigit(oname[nlen - 1])) /* is it a group? */ + /* is it a group? */ + if (nlen && !isdigit((unsigned char)oname[nlen - 1])) if (printgroup(oname, ifaliases) != -1) { free(oname); return; @@ -952,14 +953,14 @@ printif(char *ifname, int ifaliases) namep = NULL; for (ifa = ifap; ifa; ifa = ifa->ifa_next) { if (oname) { - if (nlen && isdigit(oname[nlen - 1])) { + if (nlen && isdigit((unsigned char)oname[nlen - 1])) { /* must have exact match */ if (strcmp(oname, ifa->ifa_name) != 0) continue; } else { /* partial match OK if it ends w/ digit */ if (strncmp(oname, ifa->ifa_name, nlen) != 0 || - !isdigit(ifa->ifa_name[nlen])) + !isdigit((unsigned char)ifa->ifa_name[nlen])) continue; } } @@ -1376,7 +1377,8 @@ setifgroup(const char *group_name, int dummy) memset(&ifgr, 0, sizeof(ifgr)); strlcpy(ifgr.ifgr_name, name, IFNAMSIZ); - if (group_name[0] && isdigit(group_name[strlen(group_name) - 1])) + if (group_name[0] && + isdigit((unsigned char)group_name[strlen(group_name) - 1])) errx(1, "setifgroup: group names may not end in a digit"); if (strlcpy(ifgr.ifgr_group, group_name, IFNAMSIZ) >= IFNAMSIZ) @@ -1396,7 +1398,8 @@ unsetifgroup(const char *group_name, int dummy) memset(&ifgr, 0, sizeof(ifgr)); strlcpy(ifgr.ifgr_name, name, IFNAMSIZ); - if (group_name[0] && isdigit(group_name[strlen(group_name) - 1])) + if (group_name[0] && + isdigit((unsigned char)group_name[strlen(group_name) - 1])) errx(1, "unsetifgroup: group names may not end in a digit"); if (strlcpy(ifgr.ifgr_group, group_name, IFNAMSIZ) >= IFNAMSIZ) @@ -1556,7 +1559,7 @@ setifnwkey(const char *val, int d) goto set_nwkey; } else { set_nwkey: - if (isdigit(val[0]) && val[1] == ':') { + if (isdigit((unsigned char)val[0]) && val[1] == ':') { /* specifying a full set of four keys */ nwkey.i_defkid = val[0] - '0'; val += 2; @@ -2045,7 +2048,7 @@ ieee80211_status(void) /* check extra ambiguity with keywords */ if (!nwkey_verbose) { if (nwkey.i_key[0].i_keylen >= 2 && - isdigit(nwkey.i_key[0].i_keydat[0]) && + isdigit((unsigned char)nwkey.i_key[0].i_keydat[0]) && nwkey.i_key[0].i_keydat[1] == ':') nwkey_verbose = 1; else if (nwkey.i_key[0].i_keylen >= 7 && @@ -2461,7 +2464,7 @@ settimeslot(const char *val, int d) #define RANGE_CHANNEL 0x2 #define ALL_CHANNELS 0xFFFFFFFF unsigned long ts_map = 0; - char *ptr = (char*)val; + char *ptr = (char *)val; int ts_flag = 0; int ts = 0, ts_start = 0; @@ -2469,7 +2472,7 @@ settimeslot(const char *val, int d) ts_map = ALL_CHANNELS; } else { while (*ptr != '\0') { - if (isdigit(*ptr)) { + if (isdigit((unsigned char)*ptr)) { ts = strtoul(ptr, &ptr, 10); ts_flag |= SINGLE_CHANNEL; } else { diff --git a/sbin/iked/parse.y b/sbin/iked/parse.y index 83b6d318442..d9f3f93e365 100644 --- a/sbin/iked/parse.y +++ b/sbin/iked/parse.y @@ -1,4 +1,4 @@ -/* $OpenBSD: parse.y,v 1.30 2013/03/21 04:30:14 deraadt Exp $ */ +/* $OpenBSD: parse.y,v 1.31 2013/11/22 04:12:47 deraadt Exp $ */ /* * Copyright (c) 2010-2013 Reyk Floeter <reyk@openbsd.org> @@ -825,7 +825,7 @@ byte_spec : NUMBER { yyerror("invalid byte specification: %s", $1); YYERROR; } - switch (toupper(unit)) { + switch (toupper((unsigned char)unit)) { case 'K': bytes *= 1024; break; @@ -854,7 +854,7 @@ time_spec : NUMBER { yyerror("invalid time specification: %s", $1); YYERROR; } - switch (tolower(unit)) { + switch (tolower((unsigned char)unit)) { case 'm': seconds *= 60; break; diff --git a/sbin/iked/util.c b/sbin/iked/util.c index 3238f7a0db9..f27a68d116d 100644 --- a/sbin/iked/util.c +++ b/sbin/iked/util.c @@ -1,4 +1,4 @@ -/* $OpenBSD: util.c,v 1.20 2013/11/21 17:46:17 millert Exp $ */ +/* $OpenBSD: util.c,v 1.21 2013/11/22 04:12:47 deraadt Exp $ */ /* * Copyright (c) 2010-2013 Reyk Floeter <reyk@openbsd.org> @@ -407,7 +407,7 @@ void lc_string(char *str) { for (; *str != '\0'; str++) - *str = tolower(*str); + *str = tolower((unsigned char)*str); } void @@ -472,7 +472,7 @@ print_bits(u_short v, u_char *bits) } any = 1; for (; (c = *bits) > 32; bits++) { - buf[idx][j++] = tolower(c); + buf[idx][j++] = tolower((unsigned char)c); if (j >= sizeof(buf[idx])) return (buf[idx]); } @@ -619,7 +619,7 @@ get_string(u_int8_t *ptr, size_t len) char *str; for (i = 0; i < len; i++) - if (!isprint((char)ptr[i])) + if (!isprint(ptr[i])) break; if ((str = calloc(1, i + 1)) == NULL) diff --git a/sbin/ipsecctl/parse.y b/sbin/ipsecctl/parse.y index 82d48467092..ab4d1161f89 100644 --- a/sbin/ipsecctl/parse.y +++ b/sbin/ipsecctl/parse.y @@ -1,4 +1,4 @@ -/* $OpenBSD: parse.y,v 1.156 2012/07/10 13:58:33 lteo Exp $ */ +/* $OpenBSD: parse.y,v 1.157 2013/11/22 04:12:47 deraadt Exp $ */ /* * Copyright (c) 2002, 2003, 2004 Henning Brauer <henning@openbsd.org> @@ -1983,7 +1983,7 @@ parse_life(const char *value) ret = sscanf(value, "%d%c", &seconds, &unit); if (ret == 2) { - switch (tolower(unit)) { + switch (tolower((unsigned char)unit)) { case 'm': seconds *= 60; break; diff --git a/sbin/isakmpd/conf.c b/sbin/isakmpd/conf.c index c4526d2ef17..4a80b426113 100644 --- a/sbin/isakmpd/conf.c +++ b/sbin/isakmpd/conf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: conf.c,v 1.102 2013/03/21 04:30:14 deraadt Exp $ */ +/* $OpenBSD: conf.c,v 1.103 2013/11/22 04:12:47 deraadt Exp $ */ /* $EOM: conf.c,v 1.48 2000/12/04 02:04:29 angelos Exp $ */ /* @@ -92,7 +92,7 @@ conf_hash(char *s) u_int8_t hash = 0; while (*s) { - hash = ((hash << 1) | (hash >> 7)) ^ tolower(*s); + hash = ((hash << 1) | (hash >> 7)) ^ tolower((unsigned char)*s); s++; } return hash; @@ -242,7 +242,7 @@ conf_parse_line(int trans, char *line, int ln, size_t sz) val = line + i + 1 + strspn(line + i + 1, " \t"); /* Skip trailing whitespace, if any */ for (j = sz - (val - line) - 1; j > 0 && - isspace(val[j]); j--) + isspace((unsigned char)val[j]); j--) val[j] = '\0'; /* XXX Perhaps should we not ignore errors? */ conf_set(trans, section, line, val, 0, 0); @@ -763,11 +763,11 @@ conf_get_list(char *section, char *tag) p = liststr; while ((field = strsep(&p, ",")) != NULL) { /* Skip leading whitespace */ - while (isspace(*field)) + while (isspace((unsigned char)*field)) field++; /* Skip trailing whitespace */ if (p) - for (t = p - 1; t > field && isspace(*t); t--) + for (t = p - 1; t > field && isspace((unsigned char)*t); t--) *t = '\0'; if (*field == '\0') { log_print("conf_get_list: empty field, ignoring..."); diff --git a/sbin/isakmpd/policy.c b/sbin/isakmpd/policy.c index 8230a549428..f1f919adfbb 100644 --- a/sbin/isakmpd/policy.c +++ b/sbin/isakmpd/policy.c @@ -1,4 +1,4 @@ -/* $OpenBSD: policy.c,v 1.96 2013/04/16 19:26:00 deraadt Exp $ */ +/* $OpenBSD: policy.c,v 1.97 2013/11/22 04:12:47 deraadt Exp $ */ /* $EOM: policy.c,v 1.49 2000/10/24 13:33:39 niklas Exp $ */ /* @@ -919,7 +919,7 @@ policy_callback(char *name) for (i = 0; i < id_sz - ISAKMP_ID_DATA_OFF + ISAKMP_GEN_SZ; i++) - if (!isprint(*(id + ISAKMP_ID_DATA_OFF - + if (!isprint((unsigned char)*(id + ISAKMP_ID_DATA_OFF - ISAKMP_GEN_SZ + i))) break; if (i >= id_sz - ISAKMP_ID_DATA_OFF + ISAKMP_GEN_SZ) { @@ -1225,7 +1225,7 @@ policy_callback(char *name) */ for (i = 0; i < idremotesz - ISAKMP_ID_DATA_OFF; i++) - if (!isprint(*(idremote + + if (!isprint((unsigned char)*(idremote + ISAKMP_ID_DATA_OFF + i))) break; if (i >= idremotesz - ISAKMP_ID_DATA_OFF) { @@ -1548,7 +1548,7 @@ policy_callback(char *name) */ for (i = 0; i < idlocalsz - ISAKMP_ID_DATA_OFF; i++) - if (!isprint(*(idlocal + + if (!isprint((unsigned char)*(idlocal + ISAKMP_ID_DATA_OFF + i))) break; if (i >= idlocalsz - ISAKMP_ID_DATA_OFF) { diff --git a/sbin/mount_msdos/mount_msdos.c b/sbin/mount_msdos/mount_msdos.c index 46380d6ee12..9cd5876b779 100644 --- a/sbin/mount_msdos/mount_msdos.c +++ b/sbin/mount_msdos/mount_msdos.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mount_msdos.c,v 1.27 2012/12/04 02:27:00 deraadt Exp $ */ +/* $OpenBSD: mount_msdos.c,v 1.28 2013/11/22 04:12:48 deraadt Exp $ */ /* $NetBSD: mount_msdos.c,v 1.16 1996/10/24 00:12:50 cgd Exp $ */ /* @@ -163,7 +163,8 @@ a_gid(char *s) if ((gr = getgrnam(s)) != NULL) gid = gr->gr_gid; else { - for (gname = s; isdigit(*s); ++s); + for (gname = s; isdigit((unsigned char)*s); ++s) + ; if (!*s) gid = atoi(gname); else @@ -182,7 +183,8 @@ a_uid(char *s) if ((pw = getpwnam(s)) != NULL) uid = pw->pw_uid; else { - for (uname = s; isdigit(*s); ++s); + for (uname = s; isdigit((unsigned char)*s); ++s) + ; if (!*s) uid = atoi(uname); else diff --git a/sbin/mountd/mountd.c b/sbin/mountd/mountd.c index d4fa7faf211..a0115c3d297 100644 --- a/sbin/mountd/mountd.c +++ b/sbin/mountd/mountd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mountd.c,v 1.71 2010/03/22 16:35:27 otto Exp $ */ +/* $OpenBSD: mountd.c,v 1.72 2013/11/22 04:12:48 deraadt Exp $ */ /* $NetBSD: mountd.c,v 1.31 1996/02/18 11:57:53 fvdl Exp $ */ /* @@ -1429,7 +1429,7 @@ get_host(char *cp, struct grouplist *grp, struct grouplist *tgrp) if (grp->gr_type != GT_NULL) return (1); if ((hp = gethostbyname(cp)) == NULL) { - if (isdigit(*cp)) { + if (isdigit((unsigned char)*cp)) { if (inet_aton(cp, &saddr) == 0) { syslog(LOG_ERR, "inet_aton failed for %s", cp); return (1); @@ -1826,7 +1826,7 @@ parsecred(char *namelist, struct ucred *cr) */ names = strsep(&namelist, " \t\n"); name = strsep(&names, ":"); - if (isdigit(*name) || *name == '-') + if (isdigit((unsigned char)*name) || *name == '-') pw = getpwuid(atoi(name)); else pw = getpwnam(name); @@ -1857,7 +1857,7 @@ parsecred(char *namelist, struct ucred *cr) */ if (pw != NULL) cr->cr_uid = pw->pw_uid; - else if (isdigit(*name) || *name == '-') + else if (isdigit((unsigned char)*name) || *name == '-') cr->cr_uid = atoi(name); else { syslog(LOG_ERR, "Unknown user: %s", name); @@ -1866,7 +1866,7 @@ parsecred(char *namelist, struct ucred *cr) cr->cr_ngroups = 0; while (names != NULL && *names != '\0' && cr->cr_ngroups < NGROUPS) { name = strsep(&names, ":"); - if (isdigit(*name) || *name == '-') { + if (isdigit((unsigned char)*name) || *name == '-') { cr->cr_groups[cr->cr_ngroups++] = atoi(name); } else { if ((gr = getgrnam(name)) == NULL) { diff --git a/sbin/newfs/newfs.c b/sbin/newfs/newfs.c index d0cb25b6481..c38de189fb0 100644 --- a/sbin/newfs/newfs.c +++ b/sbin/newfs/newfs.c @@ -1,4 +1,4 @@ -/* $OpenBSD: newfs.c,v 1.94 2013/11/05 00:51:58 krw Exp $ */ +/* $OpenBSD: newfs.c,v 1.95 2013/11/22 04:12:48 deraadt Exp $ */ /* $NetBSD: newfs.c,v 1.20 1996/05/16 07:13:03 thorpej Exp $ */ /* @@ -273,7 +273,7 @@ main(int argc, char *argv[]) fatal("file system size invalid: %s", optarg); fssize_usebytes = 0; /* in case of multiple -s */ for (s1 = optarg; *s1 != '\0'; s1++) - if (isalpha(*s1)) { + if (isalpha((unsigned char)*s1)) { fssize_usebytes = 1; break; } @@ -406,11 +406,11 @@ main(int argc, char *argv[]) cp = strchr(argv[0], '\0') - 1; if (cp == NULL || ((*cp < 'a' || *cp > ('a' + maxpartitions - 1)) - && !isdigit(*cp))) + && !isdigit((unsigned char)*cp))) fatal("%s: can't figure out file system partition", argv[0]); lp = getdisklabel(special, fsi); - if (isdigit(*cp)) + if (isdigit((unsigned char)*cp)) pp = &lp->d_partitions[0]; else pp = &lp->d_partitions[*cp - 'a']; @@ -611,7 +611,7 @@ rewritelabel(char *s, int fd, struct disklabel *lp) strncpy(specname, s, sizeof(specname) - 1); specname[sizeof(specname) - 1] = '\0'; cp = specname + strlen(specname) - 1; - if (!isdigit(*cp)) + if (!isdigit((unsigned char)*cp)) *cp = 'c'; cfd = open(specname, O_WRONLY); if (cfd < 0) diff --git a/sbin/pfctl/parse.y b/sbin/pfctl/parse.y index f00319bd2d4..719727a4957 100644 --- a/sbin/pfctl/parse.y +++ b/sbin/pfctl/parse.y @@ -1,4 +1,4 @@ -/* $OpenBSD: parse.y,v 1.626 2013/10/17 19:59:54 henning Exp $ */ +/* $OpenBSD: parse.y,v 1.627 2013/11/22 04:12:48 deraadt Exp $ */ /* * Copyright (c) 2001 Markus Friedl. All rights reserved. @@ -465,7 +465,7 @@ int parseport(char *, struct range *r, int); #define DYNIF_MULTIADDR(addr) ((addr).type == PF_ADDR_DYNIFTL && \ (!((addr).iflags & PFI_AFLAG_NOALIAS) || \ - !isdigit((addr).v.ifname[strlen((addr).v.ifname)-1]))) + !isdigit((unsigned char)(addr).v.ifname[strlen((addr).v.ifname)-1]))) %} @@ -3112,7 +3112,7 @@ dynaddr : '(' STRING ')' { char *p, *op; op = $2; - if (!isalpha(op[0])) { + if (!isalpha((unsigned char)op[0])) { yyerror("invalid interface name '%s'", op); free(op); YYERROR; diff --git a/sbin/pfctl/pfctl_optimize.c b/sbin/pfctl/pfctl_optimize.c index 0e5fde90415..5872e35f742 100644 --- a/sbin/pfctl/pfctl_optimize.c +++ b/sbin/pfctl/pfctl_optimize.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pfctl_optimize.c,v 1.32 2012/10/19 15:56:40 henning Exp $ */ +/* $OpenBSD: pfctl_optimize.c,v 1.33 2013/11/22 04:12:48 deraadt Exp $ */ /* * Copyright (c) 2004 Mike Frantzen <frantzen@openbsd.org> @@ -1489,7 +1489,7 @@ interface_group(const char *ifname) return (0); /* Real interfaces must end in a number, interface groups do not */ - if (isdigit(ifname[strlen(ifname) - 1])) + if (isdigit((unsigned char)ifname[strlen(ifname) - 1])) return (0); else return (1); diff --git a/sbin/pfctl/pfctl_osfp.c b/sbin/pfctl/pfctl_osfp.c index 5183dacfe20..9dc00dfb972 100644 --- a/sbin/pfctl/pfctl_osfp.c +++ b/sbin/pfctl/pfctl_osfp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pfctl_osfp.c,v 1.18 2010/10/18 15:55:28 deraadt Exp $ */ +/* $OpenBSD: pfctl_osfp.c,v 1.19 2013/11/22 04:12:48 deraadt Exp $ */ /* * Copyright (c) 2003 Mike Frantzen <frantzen@openbsd.org> @@ -132,9 +132,9 @@ pfctl_file_fingerprints(int dev, int opts, const char *fp_filename) break; } /* Chop off whitespace */ - while (len > 0 && isspace(line[len - 1])) + while (len > 0 && isspace((unsigned char)line[len - 1])) len--; - while (len > 0 && isspace(line[0])) { + while (len > 0 && isspace((unsigned char)line[0])) { len--; line++; } @@ -521,7 +521,7 @@ found: if (strchr(version_name, ' ')) strlcat(buf, " ", len); else if (strchr(version_name, '.') && - isdigit(*subtype_name)) + isdigit((unsigned char)*subtype_name)) strlcat(buf, ".", len); else strlcat(buf, " ", len); @@ -555,30 +555,31 @@ add_fingerprint(int dev, int opts, struct pf_osfp_ioctl *fp) #define EXPAND(field) do { \ int _dot = -1, _start = -1, _end = -1, _i = 0; \ /* pick major version out of #.# */ \ - if (isdigit(fp->field[_i]) && fp->field[_i+1] == '.') { \ + if (isdigit((unsigned char)fp->field[_i]) && \ + fp->field[_i+1] == '.') { \ _dot = fp->field[_i] - '0'; \ _i += 2; \ } \ - if (isdigit(fp->field[_i])) \ + if (isdigit((unsigned char)fp->field[_i])) \ _start = fp->field[_i++] - '0'; \ else \ break; \ - if (isdigit(fp->field[_i])) \ + if (isdigit((unsigned char)fp->field[_i])) \ _start = (_start * 10) + fp->field[_i++] - '0'; \ if (fp->field[_i++] != '-') \ break; \ - if (isdigit(fp->field[_i]) && fp->field[_i+1] == '.' && \ - fp->field[_i] - '0' == _dot) \ + if (isdigit((unsigned char)fp->field[_i]) && \ + fp->field[_i+1] == '.' && fp->field[_i] - '0' == _dot) \ _i += 2; \ else if (_dot != -1) \ break; \ - if (isdigit(fp->field[_i])) \ + if (isdigit((unsigned char)fp->field[_i])) \ _end = fp->field[_i++] - '0'; \ else \ break; \ - if (isdigit(fp->field[_i])) \ + if (isdigit((unsigned char)fp->field[_i])) \ _end = (_end * 10) + fp->field[_i++] - '0'; \ - if (isdigit(fp->field[_i])) \ + if (isdigit((unsigned char)fp->field[_i])) \ _end = (_end * 10) + fp->field[_i++] - '0'; \ if (fp->field[_i] != '\0') \ break; \ @@ -907,7 +908,7 @@ get_tcpopts(const char *filename, int lineno, const char *tcpopts, return (0); for (i = 0; tcpopts[i] && *optcnt < PF_OSFP_MAX_OPTS;) { - switch ((opt = toupper(tcpopts[i++]))) { + switch ((opt = toupper((unsigned char)tcpopts[i++]))) { case 'N': /* FALLTHROUGH */ case 'S': *packed = (*packed << PF_OSFP_TCPOPT_BITS) | @@ -943,7 +944,7 @@ get_tcpopts(const char *filename, int lineno, const char *tcpopts, i++; } do { - if (!isdigit(tcpopts[i])) { + if (!isdigit((unsigned char)tcpopts[i])) { fprintf(stderr, "%s:%d unknown " "character '%c' in %c TCP opt\n", filename, lineno, tcpopts[i], opt); @@ -984,7 +985,7 @@ get_field(char **line, size_t *len, int *fieldlen) size_t plen = *len; - while (plen && isspace(*ptr)) { + while (plen && isspace((unsigned char)*ptr)) { plen--; ptr++; } @@ -999,7 +1000,7 @@ get_field(char **line, size_t *len, int *fieldlen) } else { *len = 0; } - while (*fieldlen && isspace(ret[*fieldlen - 1])) + while (*fieldlen && isspace((unsigned char)ret[*fieldlen - 1])) (*fieldlen)--; return (ret); } diff --git a/sbin/pfctl/pfctl_parser.c b/sbin/pfctl/pfctl_parser.c index 3f9243fc09f..83390753baa 100644 --- a/sbin/pfctl/pfctl_parser.c +++ b/sbin/pfctl/pfctl_parser.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pfctl_parser.c,v 1.296 2013/10/28 15:05:35 deraadt Exp $ */ +/* $OpenBSD: pfctl_parser.c,v 1.297 2013/11/22 04:12:48 deraadt Exp $ */ /* * Copyright (c) 2001 Daniel Hartmeier @@ -309,12 +309,12 @@ string_to_loglevel(const char *name) CODE *c; char *p, buf[40]; - if (isdigit(*name)) + if (isdigit((unsigned char)*name)) return (atoi(name)); for (p = buf; *name && p < &buf[sizeof(buf) - 1]; p++, name++) { - if (isupper(*name)) - *p = tolower(*name); + if (isupper((unsigned char)*name)) + *p = tolower((unsigned char)*name); else *p = *name; } diff --git a/sbin/pfctl/pfctl_radix.c b/sbin/pfctl/pfctl_radix.c index 1fced17e5c5..ea3aabb69f0 100644 --- a/sbin/pfctl/pfctl_radix.c +++ b/sbin/pfctl/pfctl_radix.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pfctl_radix.c,v 1.29 2011/07/27 00:26:10 mcbride Exp $ */ +/* $OpenBSD: pfctl_radix.c,v 1.30 2013/11/22 04:12:48 deraadt Exp $ */ /* * Copyright (c) 2002 Cedric Berger @@ -542,7 +542,7 @@ pfr_next_token(char buf[BUF_SIZE], FILE *fp) for (;;) { /* skip spaces */ - while (isspace(next_ch) && !feof(fp)) + while (isspace((unsigned char)next_ch) && !feof(fp)) next_ch = fgetc(fp); /* remove from '#' until end of line */ if (next_ch == '#') @@ -562,7 +562,7 @@ pfr_next_token(char buf[BUF_SIZE], FILE *fp) if (i < BUF_SIZE) buf[i++] = next_ch; next_ch = fgetc(fp); - } while (!feof(fp) && !isspace(next_ch)); + } while (!feof(fp) && !isspace((unsigned char)next_ch)); if (i >= BUF_SIZE) { errno = EINVAL; return (-1); diff --git a/sbin/ping/ping.c b/sbin/ping/ping.c index f116b931aa5..e7f57ecb96e 100644 --- a/sbin/ping/ping.c +++ b/sbin/ping/ping.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ping.c,v 1.96 2013/10/28 15:05:35 deraadt Exp $ */ +/* $OpenBSD: ping.c,v 1.97 2013/11/22 04:12:48 deraadt Exp $ */ /* $NetBSD: ping.c,v 1.20 1995/08/11 22:37:58 cgd Exp $ */ /* @@ -1313,7 +1313,7 @@ fill(char *bp, char *patp) char *cp; for (cp = patp; *cp; cp++) - if (!isxdigit(*cp)) + if (!isxdigit((unsigned char)*cp)) errx(1, "patterns must be specified as hex digits"); ii = sscanf(patp, "%2x%2x%2x%2x%2x%2x%2x%2x%2x%2x%2x%2x%2x%2x%2x%2x", diff --git a/sbin/ping6/ping6.c b/sbin/ping6/ping6.c index bec4e13cb1e..970f78742c3 100644 --- a/sbin/ping6/ping6.c +++ b/sbin/ping6/ping6.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ping6.c,v 1.85 2013/10/21 08:47:10 phessler Exp $ */ +/* $OpenBSD: ping6.c,v 1.86 2013/11/22 04:12:48 deraadt Exp $ */ /* $KAME: ping6.c,v 1.163 2002/10/25 02:19:06 itojun Exp $ */ /* @@ -1239,7 +1239,8 @@ dnsdecode(const u_char **sp, const u_char *ep, const u_char *base, return NULL; /*source overrun*/ while (i-- > 0 && cp < ep) { l = snprintf(cresult, sizeof(cresult), - isprint(*cp) ? "%c" : "\\%03o", *cp & 0xff); + isprint((unsigned char)*cp) ? "%c" : "\\%03o", + *cp & 0xff); if (l >= sizeof(cresult) || l < 0) return NULL; if (strlcat(buf, cresult, bufsiz) >= bufsiz) @@ -2395,7 +2396,7 @@ fill(char *bp, char *patp) char *cp; for (cp = patp; *cp; cp++) - if (!isxdigit(*cp)) + if (!isxdigit((unsigned char)*cp)) errx(1, "patterns must be specified as hex digits"); ii = sscanf(patp, "%2x%2x%2x%2x%2x%2x%2x%2x%2x%2x%2x%2x%2x%2x%2x%2x", diff --git a/sbin/scsi/libscsi.c b/sbin/scsi/libscsi.c index 7bebda2130e..26aa7d0f930 100644 --- a/sbin/scsi/libscsi.c +++ b/sbin/scsi/libscsi.c @@ -1,4 +1,4 @@ -/* $OpenBSD: libscsi.c,v 1.8 2010/11/16 19:55:34 jasper Exp $ */ +/* $OpenBSD: libscsi.c,v 1.9 2013/11/22 04:12:48 deraadt Exp $ */ /* Copyright (c) 1994 HD Associates * (contact: dufault@hda.com) @@ -307,7 +307,7 @@ do_buff_decode(u_char *databuf, size_t len, } else plus = 0; - if (tolower(*fmt) == 'v') { + if (tolower((unsigned char)*fmt) == 'v') { /* You can't suppress a seek value. You also * can't have a variable seek when you are using * "arg_put". @@ -421,7 +421,7 @@ next_field(char **pp, char *fmt, int *width_p, int *value_p, char *name, case BETWEEN_FIELDS: if (*p == 0) state = DONE; - else if (isspace(*p)) + else if (isspace((unsigned char)*p)) p++; else if (*p == '#') { while (*p && *p != '\n') @@ -450,18 +450,18 @@ next_field(char **pp, char *fmt, int *width_p, int *value_p, char *name, } else if (*p == '*') { p++; suppress = 1; - } else if (isxdigit(*p)) { + } else if (isxdigit((unsigned char)*p)) { something = 1; value = strtol(p, &p, 16); state = START_FIELD; - } else if (tolower(*p) == 'v') { + } else if (tolower((unsigned char)*p) == 'v') { p++; something = 2; value = *value_p; state = START_FIELD; } /* try to work without the 'v' */ - else if (tolower(*p) == 'i') { + else if (tolower((unsigned char)*p) == 'i') { something = 2; value = *value_p; p++; @@ -470,7 +470,7 @@ next_field(char **pp, char *fmt, int *width_p, int *value_p, char *name, field_size = 8; field_width = strtol(p, &p, 10); state = DONE; - } else if (tolower(*p) == 't') { + } else if (tolower((unsigned char)*p) == 't') { /* XXX: B can't work: Sees the 'b' * as a hex digit in "isxdigit". * try "t" for bit field. @@ -483,10 +483,10 @@ next_field(char **pp, char *fmt, int *width_p, int *value_p, char *name, field_size = 1; field_width = strtol(p, &p, 10); state = DONE; - } else if (tolower(*p) == 's') { /* Seek */ + } else if (tolower((unsigned char)*p) == 's') { /* Seek */ *fmt = 's'; p++; - if (tolower(*p) == 'v') { + if (tolower((unsigned char)*p) == 'v') { p++; something = 2; value = *value_p; @@ -512,7 +512,7 @@ next_field(char **pp, char *fmt, int *width_p, int *value_p, char *name, break; case GET_FIELD: - if (isdigit(*p)) { + if (isdigit((unsigned char)*p)) { *fmt = 'b'; field_size = 1; field_width = strtol(p, &p, 10); diff --git a/sbin/shutdown/shutdown.c b/sbin/shutdown/shutdown.c index feec61c7361..98c42feecff 100644 --- a/sbin/shutdown/shutdown.c +++ b/sbin/shutdown/shutdown.c @@ -1,4 +1,4 @@ -/* $OpenBSD: shutdown.c,v 1.36 2009/12/24 10:06:35 sobrado Exp $ */ +/* $OpenBSD: shutdown.c,v 1.37 2013/11/22 04:12:48 deraadt Exp $ */ /* $NetBSD: shutdown.c,v 1.9 1995/03/18 15:01:09 cgd Exp $ */ /* @@ -425,7 +425,7 @@ getoffset(char *timearg) (void)time(&now); if (*timearg == '+') { /* +minutes */ - if (!isdigit(*++timearg)) + if (!isdigit((unsigned char)*++timearg)) badtime(); offset = atoi(timearg) * 60; shuttime = now + offset; @@ -434,7 +434,7 @@ getoffset(char *timearg) /* handle hh:mm by getting rid of the colon */ for (p = timearg; *p; ++p) { - if (!isascii(*p) || !isdigit(*p)) { + if (!isascii((unsigned char)*p) || !isdigit((unsigned char)*p)) { if (*p == ':' && strlen(p) == 3) { p[0] = p[1]; p[1] = p[2]; diff --git a/sbin/sysctl/sysctl.c b/sbin/sysctl/sysctl.c index 894a61ff949..7d7c9b07029 100644 --- a/sbin/sysctl/sysctl.c +++ b/sbin/sysctl/sysctl.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sysctl.c,v 1.197 2013/11/15 22:20:04 millert Exp $ */ +/* $OpenBSD: sysctl.c,v 1.198 2013/11/22 04:12:48 deraadt Exp $ */ /* $NetBSD: sysctl.c,v 1.9 1995/09/30 07:12:50 thorpej Exp $ */ /* @@ -311,7 +311,7 @@ parse(char *string, int flags) if ((cp = strchr(string, '=')) != NULL) { *strchr(buf, '=') = '\0'; *cp++ = '\0'; - while (isspace(*cp)) + while (isspace((unsigned char)*cp)) cp++; newval = cp; newsize = strlen(cp); @@ -2376,7 +2376,7 @@ sysctl_sensors(char *string, char **bufpp, int mib[], int flags, int *typep) } numt = -1; for (i = 0; typename[i] != '\0'; i++) - if (isdigit(typename[i])) { + if (isdigit((unsigned char)typename[i])) { numt = atoi(&typename[i]); typename[i] = '\0'; break; |