summaryrefslogtreecommitdiff
path: root/lib/libform
diff options
context:
space:
mode:
authordsl <dsl@NetBSD.org>2004-10-28 21:14:52 +0000
committerdsl <dsl@NetBSD.org>2004-10-28 21:14:52 +0000
commit1793b7dd6985ad85d54c5aec3a0a439d9ef9e9f4 (patch)
tree576153448c76d7e2e6b5839b40fc1c165add11d3 /lib/libform
parent31d993f26ac14f2646b05478c54ffa196870a738 (diff)
Use (unsigned char) cast to sanitise arguments to ctype functions.
Diffstat (limited to 'lib/libform')
-rw-r--r--lib/libform/type_alnum.c4
-rw-r--r--lib/libform/type_alpha.c6
-rw-r--r--lib/libform/type_integer.c6
-rw-r--r--lib/libform/type_numeric.c12
4 files changed, 14 insertions, 14 deletions
diff --git a/lib/libform/type_alnum.c b/lib/libform/type_alnum.c
index bb8000db3f7..08cba0c625a 100644
--- a/lib/libform/type_alnum.c
+++ b/lib/libform/type_alnum.c
@@ -1,4 +1,4 @@
-/* $NetBSD: type_alnum.c,v 1.8 2004/10/27 19:59:24 dsl Exp $ */
+/* $NetBSD: type_alnum.c,v 1.9 2004/10/28 21:14:52 dsl Exp $ */
/*-
* Copyright (c) 1998-1999 Brett Lymn
@@ -115,7 +115,7 @@ alnum_check_field(FIELD *field, char *args)
/* find the end of the non-whitespace stuff */
cur = start;
- while(isalnum(buf[cur] & 0xff))
+ while(isalnum((unsigned char)buf[cur]))
cur++;
/* no good if it exceeds the width */
diff --git a/lib/libform/type_alpha.c b/lib/libform/type_alpha.c
index 0f3419c9a85..dbe899940e7 100644
--- a/lib/libform/type_alpha.c
+++ b/lib/libform/type_alpha.c
@@ -1,4 +1,4 @@
-/* $NetBSD: type_alpha.c,v 1.9 2004/10/27 19:59:24 dsl Exp $ */
+/* $NetBSD: type_alpha.c,v 1.10 2004/10/28 21:14:52 dsl Exp $ */
/*-
* Copyright (c) 1998-1999 Brett Lymn
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: type_alpha.c,v 1.9 2004/10/27 19:59:24 dsl Exp $");
+__RCSID("$NetBSD: type_alpha.c,v 1.10 2004/10/28 21:14:52 dsl Exp $");
#include <stdlib.h>
#include <string.h>
@@ -117,7 +117,7 @@ alpha_check_field(FIELD *field, char *args)
/* find the end of the non-whitespace stuff */
cur = start;
- while(isalpha(buf[cur] & 0xff))
+ while(isalpha((unsigned char)buf[cur]))
cur++;
/* no good if it exceeds the width */
diff --git a/lib/libform/type_integer.c b/lib/libform/type_integer.c
index 65c2000fa20..64d5be9cd91 100644
--- a/lib/libform/type_integer.c
+++ b/lib/libform/type_integer.c
@@ -1,4 +1,4 @@
-/* $NetBSD: type_integer.c,v 1.7 2004/10/27 19:59:24 dsl Exp $ */
+/* $NetBSD: type_integer.c,v 1.8 2004/10/28 21:14:52 dsl Exp $ */
/*-
* Copyright (c) 1998-1999 Brett Lymn
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: type_integer.c,v 1.7 2004/10/27 19:59:24 dsl Exp $");
+__RCSID("$NetBSD: type_integer.c,v 1.8 2004/10/28 21:14:52 dsl Exp $");
#include <stdlib.h>
#include <strings.h>
@@ -129,7 +129,7 @@ integer_check_field(FIELD *field, char *args)
if ((buf[cur] == '-') || (buf[cur] == '+'))
cur++;
- while(isdigit(buf[cur] & 0xff))
+ while(isdigit((unsigned char)buf[cur]))
cur++;
/* check there is only trailing whitespace */
diff --git a/lib/libform/type_numeric.c b/lib/libform/type_numeric.c
index c30b795c6b1..2e2497386bc 100644
--- a/lib/libform/type_numeric.c
+++ b/lib/libform/type_numeric.c
@@ -1,4 +1,4 @@
-/* $NetBSD: type_numeric.c,v 1.7 2004/10/27 19:59:24 dsl Exp $ */
+/* $NetBSD: type_numeric.c,v 1.8 2004/10/28 21:14:52 dsl Exp $ */
/*-
* Copyright (c) 1998-1999 Brett Lymn
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: type_numeric.c,v 1.7 2004/10/27 19:59:24 dsl Exp $");
+__RCSID("$NetBSD: type_numeric.c,v 1.8 2004/10/28 21:14:52 dsl Exp $");
#include <stdlib.h>
#include <string.h>
@@ -132,14 +132,14 @@ numeric_check_field(FIELD *field, char *args)
if ((buf[cur] == '-') || (buf[cur] == '+'))
cur++;
- while(isdigit(buf[cur] & 0xff))
+ while(isdigit((unsigned char)buf[cur]))
cur++;
/* if not at end of string then check for decimal... */
if ((buf[cur] != '\0') && (buf[cur] == '.')) {
cur++;
/* check for more digits now.... */
- while(isdigit(buf[cur] & 0xff))
+ while(isdigit((unsigned char)buf[cur]))
cur++;
}
@@ -158,11 +158,11 @@ numeric_check_field(FIELD *field, char *args)
return FALSE;
/* we expect a digit now */
- if (!isdigit(buf[cur] & 0xff))
+ if (!isdigit((unsigned char)buf[cur]))
return FALSE;
/* skip digits for the final time */
- while(isdigit(buf[cur] & 0xff))
+ while(isdigit((unsigned char)buf[cur]))
cur++;
}