aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2010-01-09 18:50:52 -0800
committerGuy Harris <guy@alum.mit.edu>2010-01-09 18:50:52 -0800
commit27636b9a98a80a25c18c8ae0d6d36d454134bac1 (patch)
tree13bfb41eb3d5b01363c3747d3376fcff7e720072
parent6831a814896d7f1c31bfa68af85028e8d4182543 (diff)
Include <ctype.h>, as we use macros from it.
Also, use isascii() to avoid surprises from characters with the 8th bit set, rather than playing signed vs. unsigned character games.
-rw-r--r--pcap-linux.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/pcap-linux.c b/pcap-linux.c
index 08bd910..344917d 100644
--- a/pcap-linux.c
+++ b/pcap-linux.c
@@ -122,6 +122,7 @@ static const char rcsid[] _U_ =
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
+#include <ctype.h>
#include <unistd.h>
#include <fcntl.h>
#include <string.h>
@@ -1795,7 +1796,7 @@ scan_proc_net_dev(pcap_if_t **devlistp, char *errbuf)
int fd;
char linebuf[512];
int linenum;
- unsigned char *p;
+ char *p;
char name[512]; /* XXX - pick a size */
char *q, *saveq;
struct ifreq ifrflags;
@@ -1828,7 +1829,7 @@ scan_proc_net_dev(pcap_if_t **devlistp, char *errbuf)
/*
* Skip leading white space.
*/
- while (*p != '\0' && isspace(*p))
+ while (*p != '\0' && isascii(*p) && isspace(*p))
p++;
if (*p == '\0' || *p == '\n')
continue; /* blank line */
@@ -1837,7 +1838,7 @@ scan_proc_net_dev(pcap_if_t **devlistp, char *errbuf)
* Get the interface name.
*/
q = &name[0];
- while (*p != '\0' && !isspace(*p)) {
+ while (*p != '\0' && isascii(*p) && !isspace(*p)) {
if (*p == ':') {
/*
* This could be the separator between a
@@ -1851,7 +1852,7 @@ scan_proc_net_dev(pcap_if_t **devlistp, char *errbuf)
* next field.
*/
saveq = q;
- while (isdigit(*p))
+ while (isascii(*p) && isdigit(*p))
*q++ = *p++;
if (*p != ':') {
/*