summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>1998-03-17 06:22:01 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>1998-03-17 06:22:01 +0000
commit334a2898d5982f7351a15b5f5a934691c86c9a0e (patch)
treeb788bdb91cbd019661a2c6cfa08a7611baa20fea /lib
parent55672dc58bfe6ac470a13102dc664ab128e500bb (diff)
Set errno to EINVAL if ether_ntoa() is passed bogus data.
Diffstat (limited to 'lib')
-rw-r--r--lib/libc/net/ethers.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/libc/net/ethers.c b/lib/libc/net/ethers.c
index d7b0b32f13d..2dec56cf39e 100644
--- a/lib/libc/net/ethers.c
+++ b/lib/libc/net/ethers.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ethers.c,v 1.6 1998/03/17 06:20:25 millert Exp $ */
+/* $OpenBSD: ethers.c,v 1.7 1998/03/17 06:22:00 millert Exp $ */
/*
* Copyright (c) 1998 Todd C. Miller <Todd.Miller@courtesan.com>
@@ -37,7 +37,7 @@
*/
#if defined(LIBC_SCCS) && !defined(lint)
-static char rcsid[] = "$OpenBSD: ethers.c,v 1.6 1998/03/17 06:20:25 millert Exp $";
+static char rcsid[] = "$OpenBSD: ethers.c,v 1.7 1998/03/17 06:22:00 millert Exp $";
#endif /* LIBC_SCCS and not lint */
#include <sys/types.h>
@@ -67,8 +67,10 @@ ether_ntoa(e)
if (e->ether_addr_octet[0] > 0xFF || e->ether_addr_octet[1] > 0xFF ||
e->ether_addr_octet[2] > 0xFF || e->ether_addr_octet[3] > 0xFF ||
- e->ether_addr_octet[4] > 0xFF || e->ether_addr_octet[5] > 0xFF)
+ e->ether_addr_octet[4] > 0xFF || e->ether_addr_octet[5] > 0xFF) {
+ errno = EINVAL;
return (NULL);
+ }
(void)sprintf(a, "%02x:%02x:%02x:%02x:%02x:%02x",
e->ether_addr_octet[0], e->ether_addr_octet[1],