summaryrefslogtreecommitdiff
path: root/lib/libc/net
diff options
context:
space:
mode:
authorJun-ichiro itojun Hagino <itojun@cvs.openbsd.org>2002-02-25 03:06:11 +0000
committerJun-ichiro itojun Hagino <itojun@cvs.openbsd.org>2002-02-25 03:06:11 +0000
commit68e87cca373e3e87c94a7e7ea2a8bd151d2d7116 (patch)
treefe99c690b6237c76de213c665e5c85c5a07055d6 /lib/libc/net
parent82e822eb0030d1c5a9573a19c0c83572555ae132 (diff)
skip sockaddr correctly if sa_len < sockaddr. from niklas
Diffstat (limited to 'lib/libc/net')
-rw-r--r--lib/libc/net/if_nameindex.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/libc/net/if_nameindex.c b/lib/libc/net/if_nameindex.c
index 88f162d7dd2..2b85fbae959 100644
--- a/lib/libc/net/if_nameindex.c
+++ b/lib/libc/net/if_nameindex.c
@@ -103,6 +103,9 @@ if_nameindex(void)
p += IFNAMSIZ;
sa = p;
+ if (sa->sa_len < sizeof(struct sockaddr))
+ sa->sa_len = sizeof(struct sockaddr);
+
if (len < sa->sa_len)
goto ret;
len -= sa->sa_len;