Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/netbsd-1-4]: src/lib/libc/net Pull up revision 1.36 (requested by itojun):
details: https://anonhg.NetBSD.org/src/rev/c65d4033ddf1
branches: netbsd-1-4
changeset: 470844:c65d4033ddf1
user: he <he%NetBSD.org@localhost>
date: Fri Aug 04 15:21:27 2000 +0000
description:
Pull up revision 1.36 (requested by itojun):
Prevent host_addrs overrun, possibly provoked by rogue NIS server.
diffstat:
lib/libc/net/gethnamaddr.c | 18 ++++++++++--------
1 files changed, 10 insertions(+), 8 deletions(-)
diffs (48 lines):
diff -r 57c2d1d2ec95 -r c65d4033ddf1 lib/libc/net/gethnamaddr.c
--- a/lib/libc/net/gethnamaddr.c Thu Aug 03 21:05:24 2000 +0000
+++ b/lib/libc/net/gethnamaddr.c Fri Aug 04 15:21:27 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: gethnamaddr.c,v 1.14.2.1 2000/01/08 17:50:49 he Exp $ */
+/* $NetBSD: gethnamaddr.c,v 1.14.2.2 2000/08/04 15:21:27 he 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.14.2.1 2000/01/08 17:50:49 he Exp $");
+__RCSID("$NetBSD: gethnamaddr.c,v 1.14.2.2 2000/08/04 15:21:27 he Exp $");
#endif
#endif /* LIBC_SCCS and not lint */
@@ -1127,14 +1127,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;
@@ -1175,6 +1175,8 @@
*cp++ = '\0';
}
done:
+ if (host.h_name == NULL)
+ return (NULL);
*q = NULL;
*hap = NULL;
return (&host);
Home |
Main Index |
Thread Index |
Old Index