diff options
author | deraadt <> | 1998-11-18 23:28:54 +0000 |
---|---|---|
committer | deraadt <> | 1998-11-18 23:28:54 +0000 |
commit | 3151af1d061bb26374953fe7517461c0457d521c (patch) | |
tree | 9d94e17170c30e6fe6d292d172c423b0bc9a0810 | |
parent | f3ffe499b0cbbdef6e0e3f6e4836035d012ee630 (diff) | |
download | openbsd-3151af1d061bb26374953fe7517461c0457d521c.tar.gz openbsd-3151af1d061bb26374953fe7517461c0457d521c.tar.bz2 openbsd-3151af1d061bb26374953fe7517461c0457d521c.zip |
check for negative numbers from strtol()
-rw-r--r-- | src/lib/libc/net/ethers.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/lib/libc/net/ethers.c b/src/lib/libc/net/ethers.c index 9df876b6f4..94ae5c996a 100644 --- a/src/lib/libc/net/ethers.c +++ b/src/lib/libc/net/ethers.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: ethers.c,v 1.9 1998/06/21 22:13:44 millert Exp $ */ | 1 | /* $OpenBSD: ethers.c,v 1.10 1998/11/18 23:28:54 deraadt Exp $ */ |
2 | 2 | ||
3 | /* | 3 | /* |
4 | * Copyright (c) 1998 Todd C. Miller <Todd.Miller@courtesan.com> | 4 | * Copyright (c) 1998 Todd C. Miller <Todd.Miller@courtesan.com> |
@@ -34,7 +34,7 @@ | |||
34 | */ | 34 | */ |
35 | 35 | ||
36 | #if defined(LIBC_SCCS) && !defined(lint) | 36 | #if defined(LIBC_SCCS) && !defined(lint) |
37 | static char rcsid[] = "$OpenBSD: ethers.c,v 1.9 1998/06/21 22:13:44 millert Exp $"; | 37 | static char rcsid[] = "$OpenBSD: ethers.c,v 1.10 1998/11/18 23:28:54 deraadt Exp $"; |
38 | #endif /* LIBC_SCCS and not lint */ | 38 | #endif /* LIBC_SCCS and not lint */ |
39 | 39 | ||
40 | #include <sys/types.h> | 40 | #include <sys/types.h> |
@@ -92,7 +92,7 @@ _ether_aton(s, e) | |||
92 | /* expect 6 hex octets separated by ':' or space/NUL if last octet */ | 92 | /* expect 6 hex octets separated by ':' or space/NUL if last octet */ |
93 | for (i = 0; i < 6; i++) { | 93 | for (i = 0; i < 6; i++) { |
94 | l = strtol(s, &pp, 16); | 94 | l = strtol(s, &pp, 16); |
95 | if (pp == s || l > 0xFF) | 95 | if (pp == s || l > 0xFF || l < 0) |
96 | return (NULL); | 96 | return (NULL); |
97 | if (!(*pp == ':' || (i == 5 && (isspace(*pp) || *pp == '\0')))) | 97 | if (!(*pp == ':' || (i == 5 && (isspace(*pp) || *pp == '\0')))) |
98 | return (NULL); | 98 | return (NULL); |