Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/netbsd-1-5]: src/lib/libc/net pullup 1.35 -> 1.36 (approved by releng-1-5)
details: https://anonhg.NetBSD.org/src/rev/a8d02c201654
branches: netbsd-1-5
changeset: 488800:a8d02c201654
user: itojun <itojun%NetBSD.org@localhost>
date: Sun Jul 30 05:45:30 2000 +0000
description:
pullup 1.35 -> 1.36 (approved by releng-1-5)
> plug host_addrs overrun. rogue NIS server can transmit tons of lines,
> effectively overrun host_addrs buffer.
diffstat:
lib/libc/net/gethnamaddr.c | 18 ++++++++++--------
1 files changed, 10 insertions(+), 8 deletions(-)
diffs (48 lines):
diff -r 3245c888815b -r a8d02c201654 lib/libc/net/gethnamaddr.c
--- a/lib/libc/net/gethnamaddr.c Sun Jul 30 05:38:49 2000 +0000
+++ b/lib/libc/net/gethnamaddr.c Sun Jul 30 05:45:30 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: gethnamaddr.c,v 1.33 2000/05/23 07:03:10 tron Exp $ */
+/* $NetBSD: gethnamaddr.c,v 1.33.4.1 2000/07/30 05:45:30 itojun Exp $ */
/*
* ++Copyright++ 1985, 1988, 1993
@@ -61,7 +61,7 @@
static char sccsid[] = "@(#)gethostnamadr.c 8.1 (Berkeley) 6/4/93";
static char rcsid[] = "Id: gethnamaddr.c,v 8.21 1997/06/01 20:34:37 vixie Exp ";
#else
-__RCSID("$NetBSD: gethnamaddr.c,v 1.33 2000/05/23 07:03:10 tron Exp $");
+__RCSID("$NetBSD: gethnamaddr.c,v 1.33.4.1 2000/07/30 05:45:30 itojun Exp $");
#endif
#endif /* LIBC_SCCS and not lint */
@@ -1272,14 +1272,14 @@
* XXX: maybe support IPv6 parsing, based on 'af' setting
*/
nextline:
+ /* check for host_addrs overflow */
+ if (buf >= &host_addrs[sizeof(host_addrs) / sizeof(host_addrs[0])])
+ goto done;
+
more = 0;
cp = strpbrk(p, " \t");
- if (cp == NULL) {
- if (host.h_name == NULL)
- return (NULL);
- else
- goto done;
- }
+ if (cp == NULL)
+ goto done;
*cp++ = '\0';
*hap++ = (char *)(void *)buf;
@@ -1320,6 +1320,8 @@
*cp++ = '\0';
}
done:
+ if (host.h_name == NULL)
+ return (NULL);
*q = NULL;
*hap = NULL;
return (&host);
Home |
Main Index |
Thread Index |
Old Index