summaryrefslogtreecommitdiff
path: root/lib/libc/net
diff options
context:
space:
mode:
authorJun-ichiro itojun Hagino <itojun@cvs.openbsd.org>2001-08-20 02:27:11 +0000
committerJun-ichiro itojun Hagino <itojun@cvs.openbsd.org>2001-08-20 02:27:11 +0000
commitb96be2bd048ecbb6066170b0f55f916b9af7b80c (patch)
tree3efadf1800963438a56e512917a5c06f4b766097 /lib/libc/net
parent15b40ddd3ffe39fcb47c270b4405c53c273f2e7e (diff)
cope with sa_len < sizeof(struct sockaddr).
From: Patrik Lindergren <patrik@datacom.nu>
Diffstat (limited to 'lib/libc/net')
-rw-r--r--lib/libc/net/getifaddrs.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/libc/net/getifaddrs.c b/lib/libc/net/getifaddrs.c
index 5c9c337f711..ca69af8b9e4 100644
--- a/lib/libc/net/getifaddrs.c
+++ b/lib/libc/net/getifaddrs.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: getifaddrs.c,v 1.5 2001/07/04 19:43:16 deraadt Exp $ */
+/* $OpenBSD: getifaddrs.c,v 1.6 2001/08/20 02:27:10 itojun Exp $ */
/*
* Copyright (c) 1995, 1999
@@ -213,7 +213,10 @@ getifaddrs(struct ifaddrs **pif)
dcnt += SA_RLEN(sa);
ncnt += sizeof(ifr->ifr_name) + 1;
- ifr = (struct ifreq *)(((char *)sa) + SA_LEN(sa));
+ if (SA_LEN(sa) < sizeof(*sa))
+ ifr = (struct ifreq *)(((char *)sa) + sizeof(*sa));
+ else
+ ifr = (struct ifreq *)(((char *)sa) + SA_LEN(sa));
}
#endif /* NET_RT_IFLIST */