summaryrefslogtreecommitdiffstats
path: root/usr.sbin/ldapd/syntax.c
diff options
context:
space:
mode:
authorderaadt <deraadt@openbsd.org>2013-11-23 18:02:44 +0000
committerderaadt <deraadt@openbsd.org>2013-11-23 18:02:44 +0000
commita509009b31329892b93b53408d6e29be46729f2e (patch)
tree19c077a7f6b913a0610b1ea82ea9ae3d42eec2ab /usr.sbin/ldapd/syntax.c
parentunsigned char casts for ctype (diff)
downloadwireguard-openbsd-a509009b31329892b93b53408d6e29be46729f2e.tar.xz
wireguard-openbsd-a509009b31329892b93b53408d6e29be46729f2e.zip
unsigned char casts for ctype
ok jca
Diffstat (limited to 'usr.sbin/ldapd/syntax.c')
-rw-r--r--usr.sbin/ldapd/syntax.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/usr.sbin/ldapd/syntax.c b/usr.sbin/ldapd/syntax.c
index 69a46388015..bfae26effc9 100644
--- a/usr.sbin/ldapd/syntax.c
+++ b/usr.sbin/ldapd/syntax.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: syntax.c,v 1.1 2010/09/03 09:39:17 martinh Exp $ */
+/* $OpenBSD: syntax.c,v 1.2 2013/11/23 18:02:44 deraadt Exp $ */
/*
* Copyright (c) 2010 Martin Hedenfalk <martin@bzero.se>
@@ -180,7 +180,7 @@ syntax_is_integer(struct schema *schema, char *value, size_t len)
if (*value == '0')
return value[1] == '\0';
for (value++; *value != '\0'; value++)
- if (!isdigit(*value))
+ if (!isdigit((unsigned char)*value))
return 0;
return 1;
}
@@ -254,7 +254,7 @@ syntax_is_numeric_string(struct schema *schema, char *value, size_t len)
char *p;
for (p = value; *p != '\0'; p++)
- if (!isdigit(*p) || *p != ' ')
+ if (!isdigit((unsigned char)*p) || *p != ' ')
return 0;
return p != value;
@@ -267,7 +267,8 @@ syntax_is_time(struct schema *schema, char *value, size_t len, int gen)
char *p = value;
#define CHECK_RANGE(min, max) \
- if (!isdigit(p[0]) || !isdigit(p[1])) \
+ if (!isdigit((unsigned char)p[0]) || \
+ !isdigit((unsigned char)p[1])) \
return 0; \
n = (p[0] - '0') * 10 + (p[1] - '0'); \
if (n < min || n > max) \
@@ -282,21 +283,22 @@ syntax_is_time(struct schema *schema, char *value, size_t len, int gen)
/* FIXME: should check number of days in month */
CHECK_RANGE(0, 23); /* hour */
- if (!gen || isdigit(*p)) {
+ if (!gen || isdigit((unsigned char)*p)) {
CHECK_RANGE(0, 59); /* minute */
- if (!gen && isdigit(*p))
+ if (!gen && isdigit((unsigned char)*p))
CHECK_RANGE(0, 59+gen); /* second or leap-second */
if (*p == '\0')
return 1;
}
/* fraction */
- if (!gen && ((*p == ',' || *p == '.') && !isdigit(*++p)))
+ if (!gen && ((*p == ',' || *p == '.') &&
+ !isdigit((unsigned char)*++p)))
return 0;
if (*p == '-' || *p == '+') {
++p;
CHECK_RANGE(0, 23); /* hour */
- if (!gen || isdigit(*p))
+ if (!gen || isdigit((unsigned char)*p))
CHECK_RANGE(0, 59); /* minute */
} else if (*p++ != 'Z')
return 0;