From 3151af1d061bb26374953fe7517461c0457d521c Mon Sep 17 00:00:00 2001 From: deraadt <> Date: Wed, 18 Nov 1998 23:28:54 +0000 Subject: check for negative numbers from strtol() --- src/lib/libc/net/ethers.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src') 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 @@ -/* $OpenBSD: ethers.c,v 1.9 1998/06/21 22:13:44 millert Exp $ */ +/* $OpenBSD: ethers.c,v 1.10 1998/11/18 23:28:54 deraadt Exp $ */ /* * Copyright (c) 1998 Todd C. Miller @@ -34,7 +34,7 @@ */ #if defined(LIBC_SCCS) && !defined(lint) -static char rcsid[] = "$OpenBSD: ethers.c,v 1.9 1998/06/21 22:13:44 millert Exp $"; +static char rcsid[] = "$OpenBSD: ethers.c,v 1.10 1998/11/18 23:28:54 deraadt Exp $"; #endif /* LIBC_SCCS and not lint */ #include @@ -92,7 +92,7 @@ _ether_aton(s, e) /* expect 6 hex octets separated by ':' or space/NUL if last octet */ for (i = 0; i < 6; i++) { l = strtol(s, &pp, 16); - if (pp == s || l > 0xFF) + if (pp == s || l > 0xFF || l < 0) return (NULL); if (!(*pp == ':' || (i == 5 && (isspace(*pp) || *pp == '\0')))) return (NULL); -- cgit v1.2.3-55-g6feb