From 68e87cca373e3e87c94a7e7ea2a8bd151d2d7116 Mon Sep 17 00:00:00 2001 From: Jun-ichiro itojun Hagino Date: Mon, 25 Feb 2002 03:06:11 +0000 Subject: skip sockaddr correctly if sa_len < sockaddr. from niklas --- lib/libc/net/if_nameindex.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'lib/libc/net') 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; -- cgit v1.2.3