summaryrefslogtreecommitdiff
path: root/lib/libc
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libc')
-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;