NetBSD-Bugs archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: lib/48926: gethostbyname(3) doesn't appear to work under NetBSD-5.2 and NetBSD-6.1.x when hostnames appear only in /etc/hosts
The following reply was made to PR lib/48926; it has been noted by GNATS.
From: Joerg Sonnenberger <joerg%britannica.bec.de@localhost>
To: gnats-bugs%NetBSD.org@localhost
Cc:
Subject: Re: lib/48926: gethostbyname(3) doesn't appear to work under
NetBSD-5.2 and NetBSD-6.1.x when hostnames appear only in /etc/hosts
Date: Mon, 23 Jun 2014 17:26:25 +0200
On Mon, Jun 23, 2014 at 03:10:13PM +0000, Brian Buhrow wrote:
> Index: gethnamaddr.c
> ===================================================================
> RCS file: /cvsroot/src/lib/libc/net/gethnamaddr.c,v
> retrieving revision 1.73.18.3
> diff -u -r1.73.18.3 gethnamaddr.c
> --- gethnamaddr.c 23 Dec 2013 23:12:44 -0000 1.73.18.3
> +++ gethnamaddr.c 23 Jun 2014 14:46:25 -0000
> @@ -742,10 +742,9 @@
> 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, "#"))
> + *cp = '\0';
> if (!(cp = strpbrk(p, " \t")))
> goto again;
> *cp++ = '\0';
>
What about checking whether p[len -1] is blankish first?
Joerg
Home |
Main Index |
Thread Index |
Old Index