Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/lib/libc/net cope with sa_len < sizeof(struct sockaddr).
details: https://anonhg.NetBSD.org/src/rev/812a428ba66e
branches: trunk
changeset: 514010:812a428ba66e
user: itojun <itojun%NetBSD.org@localhost>
date: Mon Aug 20 02:33:49 2001 +0000
description:
cope with sa_len < sizeof(struct sockaddr).
From: Patrik Lindergren <patrik%datacom.nu@localhost>
sync with kame
diffstat:
lib/libc/net/getifaddrs.c | 9 ++++++---
1 files changed, 6 insertions(+), 3 deletions(-)
diffs (30 lines):
diff -r dff134f0eec0 -r 812a428ba66e lib/libc/net/getifaddrs.c
--- a/lib/libc/net/getifaddrs.c Mon Aug 20 02:33:31 2001 +0000
+++ b/lib/libc/net/getifaddrs.c Mon Aug 20 02:33:49 2001 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: getifaddrs.c,v 1.7 2001/01/04 03:57:58 lukem Exp $ */
+/* $NetBSD: getifaddrs.c,v 1.8 2001/08/20 02:33:49 itojun Exp $ */
/*
* Copyright (c) 1995, 1999
@@ -27,7 +27,7 @@
#include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: getifaddrs.c,v 1.7 2001/01/04 03:57:58 lukem Exp $");
+__RCSID("$NetBSD: getifaddrs.c,v 1.8 2001/08/20 02:33:49 itojun Exp $");
#endif /* LIBC_SCCS and not lint */
#include "namespace.h"
@@ -223,7 +223,10 @@
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 */
Home |
Main Index |
Thread Index |
Old Index