summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>1996-01-15 01:10:18 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>1996-01-15 01:10:18 +0000
commit6c1713a54612f47882e87eec19ec79bc5321edd7 (patch)
treeb2f0de81ff5a66f5c4348e08fea7f5d6686755b9 /lib
parenta3c84eba739237f19e84815b087e1f2a21f18194 (diff)
from netbsd:
Don't read the network address as an alias when there isn't whitespace after the network address. Closes PR 1940.
Diffstat (limited to 'lib')
-rw-r--r--lib/libc/net/getnetent.c25
1 files changed, 13 insertions, 12 deletions
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);