diff options
author | millert <> | 1998-03-17 06:22:00 +0000 |
---|---|---|
committer | millert <> | 1998-03-17 06:22:00 +0000 |
commit | e666599d9ee5e6d25a55ca96fad968202fe3c388 (patch) | |
tree | 8cdfa3d020953e56ec7abfe57fb5f086b2a0f5f4 | |
parent | dafbb6bf5ba2271888aaf9ae6e99d7c742419ce1 (diff) | |
download | openbsd-e666599d9ee5e6d25a55ca96fad968202fe3c388.tar.gz openbsd-e666599d9ee5e6d25a55ca96fad968202fe3c388.tar.bz2 openbsd-e666599d9ee5e6d25a55ca96fad968202fe3c388.zip |
Set errno to EINVAL if ether_ntoa() is passed bogus data.
-rw-r--r-- | src/lib/libc/net/ethers.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/lib/libc/net/ethers.c b/src/lib/libc/net/ethers.c index d7b0b32f13..2dec56cf39 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.6 1998/03/17 06:20:25 millert Exp $ */ | 1 | /* $OpenBSD: ethers.c,v 1.7 1998/03/17 06:22:00 millert 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> |
@@ -37,7 +37,7 @@ | |||
37 | */ | 37 | */ |
38 | 38 | ||
39 | #if defined(LIBC_SCCS) && !defined(lint) | 39 | #if defined(LIBC_SCCS) && !defined(lint) |
40 | static char rcsid[] = "$OpenBSD: ethers.c,v 1.6 1998/03/17 06:20:25 millert Exp $"; | 40 | static char rcsid[] = "$OpenBSD: ethers.c,v 1.7 1998/03/17 06:22:00 millert Exp $"; |
41 | #endif /* LIBC_SCCS and not lint */ | 41 | #endif /* LIBC_SCCS and not lint */ |
42 | 42 | ||
43 | #include <sys/types.h> | 43 | #include <sys/types.h> |
@@ -67,8 +67,10 @@ ether_ntoa(e) | |||
67 | 67 | ||
68 | if (e->ether_addr_octet[0] > 0xFF || e->ether_addr_octet[1] > 0xFF || | 68 | if (e->ether_addr_octet[0] > 0xFF || e->ether_addr_octet[1] > 0xFF || |
69 | e->ether_addr_octet[2] > 0xFF || e->ether_addr_octet[3] > 0xFF || | 69 | e->ether_addr_octet[2] > 0xFF || e->ether_addr_octet[3] > 0xFF || |
70 | e->ether_addr_octet[4] > 0xFF || e->ether_addr_octet[5] > 0xFF) | 70 | e->ether_addr_octet[4] > 0xFF || e->ether_addr_octet[5] > 0xFF) { |
71 | errno = EINVAL; | ||
71 | return (NULL); | 72 | return (NULL); |
73 | } | ||
72 | 74 | ||
73 | (void)sprintf(a, "%02x:%02x:%02x:%02x:%02x:%02x", | 75 | (void)sprintf(a, "%02x:%02x:%02x:%02x:%02x:%02x", |
74 | e->ether_addr_octet[0], e->ether_addr_octet[1], | 76 | e->ether_addr_octet[0], e->ether_addr_octet[1], |