summaryrefslogtreecommitdiff
path: root/sbin/pfctl/pfctl_osfp.c
diff options
context:
space:
mode:
Diffstat (limited to 'sbin/pfctl/pfctl_osfp.c')
-rw-r--r--sbin/pfctl/pfctl_osfp.c33
1 files changed, 17 insertions, 16 deletions
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);
}