summaryrefslogtreecommitdiffstats
path: root/lib/libutil
diff options
context:
space:
mode:
authorderaadt <deraadt@openbsd.org>2013-11-29 19:00:50 +0000
committerderaadt <deraadt@openbsd.org>2013-11-29 19:00:50 +0000
commit80c62621bb25d2491e07ab57f489fdca1ee0d448 (patch)
tree01dd28d9a1e9f248b9742f6e236b4d071b5e9e49 /lib/libutil
parentDon't try to reuse _initial_thread in the fork() wrapper, as the (diff)
downloadwireguard-openbsd-80c62621bb25d2491e07ab57f489fdca1ee0d448.tar.xz
wireguard-openbsd-80c62621bb25d2491e07ab57f489fdca1ee0d448.zip
fairly simple unsigned char casts for ctype
ok krw
Diffstat (limited to 'lib/libutil')
-rw-r--r--lib/libutil/fmt_scaled.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/lib/libutil/fmt_scaled.c b/lib/libutil/fmt_scaled.c
index 83f9fa91fc0..eecbde7a68f 100644
--- a/lib/libutil/fmt_scaled.c
+++ b/lib/libutil/fmt_scaled.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: fmt_scaled.c,v 1.11 2012/11/12 14:07:20 halex Exp $ */
+/* $OpenBSD: fmt_scaled.c,v 1.12 2013/11/29 19:00:51 deraadt Exp $ */
/*
* Copyright (c) 2001, 2002, 2003 Ian F. Darwin. All rights reserved.
@@ -77,7 +77,7 @@ scan_scaled(char *scaled, long long *result)
long long scale_fact = 1, whole = 0, fpart = 0;
/* Skip leading whitespace */
- while (isascii(*p) && isspace(*p))
+ while (isascii((unsigned char)*p) && isspace((unsigned char)*p))
++p;
/* Then at most one leading + or - */
@@ -104,7 +104,8 @@ scan_scaled(char *scaled, long long *result)
* (but note that E for Exa might look like e to some!).
* Advance 'p' to end, to get scale factor.
*/
- for (; isascii(*p) && (isdigit(*p) || *p=='.'); ++p) {
+ for (; isascii((unsigned char)*p) &&
+ (isdigit((unsigned char)*p) || *p=='.'); ++p) {
if (*p == '.') {
if (fract_digits > 0) { /* oops, more than one '.' */
errno = EINVAL;
@@ -148,10 +149,10 @@ scan_scaled(char *scaled, long long *result)
/* Are we there yet? */
if (*p == scale_chars[i] ||
- *p == tolower(scale_chars[i])) {
+ *p == tolower((unsigned char)scale_chars[i])) {
/* If it ends with alphanumerics after the scale char, bad. */
- if (isalnum(*(p+1))) {
+ if (isalnum((unsigned char)*(p+1))) {
errno = EINVAL;
return -1;
}