summaryrefslogtreecommitdiff
path: root/usr.sbin
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>1999-02-16 05:54:09 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>1999-02-16 05:54:09 +0000
commitb58a1a6c18a32db53f7e727c2a90c68c552b56b6 (patch)
tree8516cfa9e3302c19a1b09fa40282eccb9fb60341 /usr.sbin
parent242304e59789ea65bfef27236075084b192d249b (diff)
handle sa_len being 0 in SIOCGIFCONF
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/ypbind/ypbind.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/usr.sbin/ypbind/ypbind.c b/usr.sbin/ypbind/ypbind.c
index 6cffb4cc7ae..601aae64178 100644
--- a/usr.sbin/ypbind/ypbind.c
+++ b/usr.sbin/ypbind/ypbind.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ypbind.c,v 1.36 1998/08/15 17:24:17 deraadt Exp $ */
+/* $OpenBSD: ypbind.c,v 1.37 1999/02/16 05:54:08 deraadt Exp $ */
/*
* Copyright (c) 1997,1998 Theo de Raadt <deraadt@OpenBSD.org>
@@ -35,7 +35,7 @@
*/
#ifndef LINT
-static char rcsid[] = "$OpenBSD: ypbind.c,v 1.36 1998/08/15 17:24:17 deraadt Exp $";
+static char rcsid[] = "$OpenBSD: ypbind.c,v 1.37 1999/02/16 05:54:08 deraadt Exp $";
#endif
#include <sys/param.h>
@@ -793,7 +793,9 @@ broadcast(ypdb, buf, outlen)
for (i = 0; i < ifc.ifc_len; i += len,
ifr = (struct ifreq *)((caddr_t)ifr + len)) {
#if defined(BSD) && BSD >= 199103
- len = sizeof ifr->ifr_name + ifr->ifr_addr.sa_len;
+ len = sizeof(ifr->ifr_name) +
+ (ifr->ifr_addr.sa_len > sizeof(struct sockaddr) ?
+ ifr->ifr_addr.sa_len : sizeof(struct sockaddr));
#else
len = sizeof ifc.ifc_len / sizeof(struct ifreq);
#endif