From 334a2898d5982f7351a15b5f5a934691c86c9a0e Mon Sep 17 00:00:00 2001 From: "Todd C. Miller" Date: Tue, 17 Mar 1998 06:22:01 +0000 Subject: Set errno to EINVAL if ether_ntoa() is passed bogus data. --- lib/libc/net/ethers.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'lib') 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 @@ -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 @@ -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], -- cgit v1.2.3