From: deraadt Date: Mon, 15 Jan 1996 01:10:17 +0000 (+0000) Subject: from netbsd: X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=4833a4b0ad6665c9a8fcf4998858a36e54b3ed95;p=openbsd from netbsd: Don't read the network address as an alias when there isn't whitespace after the network address. Closes PR 1940. --- diff --git a/lib/libc/net/getnetent.c b/lib/libc/net/getnetent.c index b4e16b8f5d6..8ecdf6c5a36 100644 --- a/lib/libc/net/getnetent.c +++ b/lib/libc/net/getnetent.c @@ -1,4 +1,4 @@ -/* $NetBSD: getnetent.c,v 1.4 1995/02/25 06:20:33 cgd Exp $ */ +/* $NetBSD: getnetent.c,v 1.5 1996/01/14 05:02:41 ghudson Exp $ */ /* * Copyright (c) 1983, 1993 @@ -37,7 +37,7 @@ #if 0 static char sccsid[] = "@(#)getnetent.c 8.1 (Berkeley) 6/4/93"; #else -static char rcsid[] = "$NetBSD: getnetent.c,v 1.4 1995/02/25 06:20:33 cgd Exp $"; +static char rcsid[] = "$NetBSD: getnetent.c,v 1.5 1996/01/14 05:02:41 ghudson Exp $"; #endif #endif /* LIBC_SCCS and not lint */ @@ -109,18 +109,19 @@ again: net.n_net = inet_network(cp); net.n_addrtype = AF_INET; q = net.n_aliases = net_aliases; - if (p != NULL) + if (p != NULL) { cp = p; - while (cp && *cp) { - if (*cp == ' ' || *cp == '\t') { - cp++; - continue; + while (cp && *cp) { + if (*cp == ' ' || *cp == '\t') { + cp++; + continue; + } + if (q < &net_aliases[MAXALIASES - 1]) + *q++ = cp; + cp = strpbrk(cp, " \t"); + if (cp != NULL) + *cp++ = '\0'; } - if (q < &net_aliases[MAXALIASES - 1]) - *q++ = cp; - cp = strpbrk(cp, " \t"); - if (cp != NULL) - *cp++ = '\0'; } *q = NULL; return (&net);