summaryrefslogtreecommitdiffstats
path: root/lib/libc
diff options
context:
space:
mode:
authormillert <millert@openbsd.org>2015-01-16 18:20:14 +0000
committermillert <millert@openbsd.org>2015-01-16 18:20:14 +0000
commit8e0291465a259d2fd77493645102631be704bf95 (patch)
treec0cc1a4875cd6d92734654bb81a0061852afb962 /lib/libc
parentReplace HOST_NAME_MAX+1-1 with HOST_NAME_MAX. OK deraad@ (diff)
downloadwireguard-openbsd-8e0291465a259d2fd77493645102631be704bf95.tar.xz
wireguard-openbsd-8e0291465a259d2fd77493645102631be704bf95.zip
Use ">", not ">=" when comparing length to HOST_NAME_MAX since
otherwise we end up needlessly replacing a NUL with a NUL. OK deraadt@
Diffstat (limited to 'lib/libc')
-rw-r--r--lib/libc/net/getnetent.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/libc/net/getnetent.c b/lib/libc/net/getnetent.c
index fc98044a37b..b16575b64d1 100644
--- a/lib/libc/net/getnetent.c
+++ b/lib/libc/net/getnetent.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: getnetent.c,v 1.16 2015/01/16 18:18:58 millert Exp $ */
+/* $OpenBSD: getnetent.c,v 1.17 2015/01/16 18:20:14 millert Exp $ */
/*
* Copyright (c) 1983, 1993
* The Regents of the University of California. All rights reserved.
@@ -86,7 +86,7 @@ again:
if ((cp = strchr(p, '#')) != NULL)
*cp = '\0';
net.n_name = p;
- if (strlen(net.n_name) >= HOST_NAME_MAX)
+ if (strlen(net.n_name) > HOST_NAME_MAX)
net.n_name[HOST_NAME_MAX] = '\0';
cp = strpbrk(p, " \t");
if (cp == NULL)
@@ -108,7 +108,7 @@ again:
}
if (q < &net_aliases[MAXALIASES - 1]) {
*q++ = cp;
- if (strlen(cp) >= HOST_NAME_MAX)
+ if (strlen(cp) > HOST_NAME_MAX)
cp[HOST_NAME_MAX] = '\0';
}
cp = strpbrk(cp, " \t");