summaryrefslogtreecommitdiffstats
path: root/lib/libc
diff options
context:
space:
mode:
authorderaadt <deraadt@openbsd.org>1996-01-15 01:10:17 +0000
committerderaadt <deraadt@openbsd.org>1996-01-15 01:10:17 +0000
commit4833a4b0ad6665c9a8fcf4998858a36e54b3ed95 (patch)
treebc219146984af6634238cb455331a1bfa79fc9db /lib/libc
parentatari specific libsa shrinkage is nasty (diff)
downloadwireguard-openbsd-4833a4b0ad6665c9a8fcf4998858a36e54b3ed95.tar.xz
wireguard-openbsd-4833a4b0ad6665c9a8fcf4998858a36e54b3ed95.zip
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/libc')
-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);