Module Name: src
Committed By: snj
Date: Tue Jun 21 19:39:25 UTC 2016
Modified Files:
src/lib/libc/net [netbsd-6]: gethnamaddr.c
Log Message:
Pull up following revision(s) (requested by buhrow in ticket #1085):
src/lib/libc/net/gethnamaddr.c: patch
Fix parsing of /etc/hosts. PR lib/48926.
To generate a diff of this commit:
cvs rdiff -u -r1.77.4.2 -r1.77.4.3 src/lib/libc/net/gethnamaddr.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/lib/libc/net/gethnamaddr.c
diff -u src/lib/libc/net/gethnamaddr.c:1.77.4.2 src/lib/libc/net/gethnamaddr.c:1.77.4.3
--- src/lib/libc/net/gethnamaddr.c:1.77.4.2 Mon Dec 23 22:56:48 2013
+++ src/lib/libc/net/gethnamaddr.c Tue Jun 21 19:39:25 2016
@@ -1,4 +1,4 @@
-/* $NetBSD: gethnamaddr.c,v 1.77.4.2 2013/12/23 22:56:48 riz Exp $ */
+/* $NetBSD: gethnamaddr.c,v 1.77.4.3 2016/06/21 19:39:25 snj Exp $ */
/*
* ++Copyright++ 1985, 1988, 1993
@@ -57,7 +57,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.77.4.2 2013/12/23 22:56:48 riz Exp $");
+__RCSID("$NetBSD: gethnamaddr.c,v 1.77.4.3 2016/06/21 19:39:25 snj Exp $");
#endif
#endif /* LIBC_SCCS and not lint */
@@ -742,10 +742,9 @@ gethostent_r(FILE *hf, struct hostent *h
goto again;
if (*p == '#')
goto again;
- p[llen] = '\0';
- if (!(cp = strpbrk(p, "#\n")))
- goto again;
- *cp = '\0';
+ p[llen - 1] = '\0';
+ if ((cp = strpbrk(p, "#")) != NULL)
+ *cp = '\0';
if (!(cp = strpbrk(p, " \t")))
goto again;
*cp++ = '\0';