diff options
-rw-r--r-- | usr.bin/tput/tput.c | 8 | ||||
-rw-r--r-- | usr.bin/tsort/tsort.c | 13 | ||||
-rw-r--r-- | usr.bin/units/units.c | 4 | ||||
-rw-r--r-- | usr.bin/usbhidaction/usbhidaction.c | 6 | ||||
-rw-r--r-- | usr.bin/usbhidctl/usbhid.c | 4 | ||||
-rw-r--r-- | usr.bin/x99token/x99token.c | 12 |
6 files changed, 26 insertions, 21 deletions
diff --git a/usr.bin/tput/tput.c b/usr.bin/tput/tput.c index c6041e3d92e..7236a757d17 100644 --- a/usr.bin/tput/tput.c +++ b/usr.bin/tput/tput.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tput.c,v 1.17 2009/10/27 23:59:46 deraadt Exp $ */ +/* $OpenBSD: tput.c,v 1.18 2013/11/27 00:13:24 deraadt Exp $ */ /* * Copyright (c) 1999 Todd C. Miller <Todd.Miller@courtesan.com> @@ -203,7 +203,8 @@ process(char *cap, char *str, char **argv) break; case 'p': cp++; - if (isdigit(cp[1]) && popcount < cp[1] - '0') + if (isdigit((unsigned char)cp[1]) && + popcount < cp[1] - '0') popcount = cp[1] - '0'; break; case 'd': @@ -240,7 +241,8 @@ process(char *cap, char *str, char **argv) arg_need, cap); /* convert ascii representation of numbers to longs */ - if (isdigit(argv[i][0]) && (l = strtol(argv[i], &cp, 10)) >= 0 + if ((unsigned char)isdigit(argv[i][0]) + && (l = strtol(argv[i], &cp, 10)) >= 0 && l < LONG_MAX && *cp == '\0') nargv[i] = (char *)l; else diff --git a/usr.bin/tsort/tsort.c b/usr.bin/tsort/tsort.c index 745de72c7f5..de242dcb581 100644 --- a/usr.bin/tsort/tsort.c +++ b/usr.bin/tsort/tsort.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tsort.c,v 1.21 2012/03/29 22:04:28 jmc Exp $ */ +/* $OpenBSD: tsort.c,v 1.22 2013/11/27 00:13:24 deraadt Exp $ */ /* ex:ts=8 sw=4: * * Copyright (c) 1999-2004 Marc Espie <espie@openbsd.org> @@ -315,11 +315,13 @@ read_pairs(FILE *f, struct ohash *h, int reverse, const char *name, for (;;) { char *e; - while (str < sentinel && isspace(*str)) + while (str < sentinel && + isspace((unsigned char)*str)) str++; if (str == sentinel) break; - for (e = str; e < sentinel && !isspace(*e); e++) + for (e = str; + e < sentinel && !isspace((unsigned char)*e); e++) continue; if (toggle) { a = node_lookup(h, str, e); @@ -363,11 +365,12 @@ read_hints(FILE *f, struct ohash *h, int quiet, const char *name, char *e; struct node *a; - while (str < sentinel && isspace(*str)) + while (str < sentinel && isspace((unsigned char)*str)) str++; if (str == sentinel) break; - for (e = str; e < sentinel && !isspace(*e); e++) + for (e = str; + e < sentinel && !isspace((unsigned char)*e); e++) continue; a = node_lookup(h, str, e); if (a->order != NO_ORDER) { diff --git a/usr.bin/units/units.c b/usr.bin/units/units.c index 9b24ed52260..df222dee88d 100644 --- a/usr.bin/units/units.c +++ b/usr.bin/units/units.c @@ -1,4 +1,4 @@ -/* $OpenBSD: units.c,v 1.19 2013/11/17 20:19:36 okan Exp $ */ +/* $OpenBSD: units.c,v 1.20 2013/11/27 00:13:24 deraadt Exp $ */ /* $NetBSD: units.c,v 1.6 1996/04/06 06:01:03 thorpej Exp $ */ /* @@ -290,7 +290,7 @@ addunit(struct unittype *theunit, char *toadd, int flip) savescr = scratch = dupstr(toadd); for (slash = scratch + 1; *slash; slash++) if (*slash == '-' && - (tolower(*(slash - 1)) != 'e' || + (tolower((unsigned char)*(slash - 1)) != 'e' || !strchr(".0123456789", *(slash + 1)))) *slash = ' '; slash = strchr(scratch, '/'); diff --git a/usr.bin/usbhidaction/usbhidaction.c b/usr.bin/usbhidaction/usbhidaction.c index dbdb4eeb9dd..4197e6e65a5 100644 --- a/usr.bin/usbhidaction/usbhidaction.c +++ b/usr.bin/usbhidaction/usbhidaction.c @@ -1,4 +1,4 @@ -/* $OpenBSD: usbhidaction.c,v 1.16 2012/03/23 10:04:59 robert Exp $ */ +/* $OpenBSD: usbhidaction.c,v 1.17 2013/11/27 00:13:23 deraadt Exp $ */ /* $NetBSD: usbhidaction.c,v 1.7 2002/01/18 14:38:59 augustss Exp $ */ /* @@ -128,7 +128,7 @@ main(int argc, char **argv) if (dev[0] != '/') { snprintf(devnamebuf, sizeof(devnamebuf), "/dev/%s%s", - isdigit(dev[0]) ? "uhid" : "", dev); + isdigit((unsigned char)dev[0]) ? "uhid" : "", dev); dev = devnamebuf; } @@ -415,7 +415,7 @@ docmd(struct command *cmd, int value, const char *hid, int argc, char **argv) if (*p == '$') { p++; len = &cmdbuf[SIZE-1] - q; - if (isdigit(*p)) { + if (isdigit((unsigned char)*p)) { n = strtol(p, &p, 10) - 1; if (n >= 0 && n < argc) { strncpy(q, argv[n], len); diff --git a/usr.bin/usbhidctl/usbhid.c b/usr.bin/usbhidctl/usbhid.c index 4646dd63d84..b8643ebe7bf 100644 --- a/usr.bin/usbhidctl/usbhid.c +++ b/usr.bin/usbhidctl/usbhid.c @@ -1,4 +1,4 @@ -/* $OpenBSD: usbhid.c,v 1.10 2010/08/02 13:57:32 miod Exp $ */ +/* $OpenBSD: usbhid.c,v 1.11 2013/11/27 00:13:23 deraadt Exp $ */ /* $NetBSD: usbhid.c,v 1.22 2002/02/20 20:30:42 christos Exp $ */ /* @@ -933,7 +933,7 @@ main(int argc, char **argv) if (dev[0] != '/') { snprintf(devnamebuf, sizeof(devnamebuf), "/dev/%s%s", - isdigit(dev[0]) ? "uhid" : "", dev); + isdigit((unsigned char)dev[0]) ? "uhid" : "", dev); dev = devnamebuf; } diff --git a/usr.bin/x99token/x99token.c b/usr.bin/x99token/x99token.c index d00dc64eb94..9cb268b3c4b 100644 --- a/usr.bin/x99token/x99token.c +++ b/usr.bin/x99token/x99token.c @@ -1,4 +1,4 @@ -/* $OpenBSD: x99token.c,v 1.8 2010/10/15 10:18:42 jsg Exp $ */ +/* $OpenBSD: x99token.c,v 1.9 2013/11/27 00:13:22 deraadt Exp $ */ /* * X9.9 calculator @@ -99,17 +99,17 @@ main(int argc, char **argv) for (i = 0; i < 8; ++i) { if (!*b) fprintf(stderr, "%s: invalid key\n", buf); - while (isdigit(*b)) + while (isdigit((unsigned char)*b)) key[i] = key[i] << 3 | (*b++ - '0'); - while (*b && !isdigit(*b)) + while (*b && !isdigit((unsigned char)*b)) ++b; } } else { for (i = 0; i < 16; ++i) { int d; - if (islower(buf[i])) - buf[i] = toupper(buf[i]); + if (islower((unsigned char)buf[i])) + buf[i] = toupper((unsigned char)buf[i]); if (buf[i] >= '0' && buf[i] <= '9') d = buf[i] - '0'; else if (buf[i] >= 'A' && buf[i] <= 'F') @@ -125,7 +125,7 @@ main(int argc, char **argv) /* XXX - should warn on non-space or non-digit */ readpassphrase("Enter Pin: ", buf, sizeof(buf), 0); for (i = 0, pin = 0; buf[i] && buf[i] != '\n'; ++i) - if (isdigit(buf[i])) + if (isdigit((unsigned char)buf[i])) pin = pin * 16 + buf[i] - '0' + 1; if ((pin & 0xffff0000) == 0) |