summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authormillert <>2015-01-16 18:20:14 +0000
committermillert <>2015-01-16 18:20:14 +0000
commit80f43df39326456df6d10fd599a8e439efdf16f1 (patch)
tree9c6ac7d9a43539781240f46e06929507cab1fe0e /src
parentf25909092c57fac1cb1e168753bbee3299bf1a18 (diff)
downloadopenbsd-80f43df39326456df6d10fd599a8e439efdf16f1.tar.gz
openbsd-80f43df39326456df6d10fd599a8e439efdf16f1.tar.bz2
openbsd-80f43df39326456df6d10fd599a8e439efdf16f1.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 'src')
-rw-r--r--src/lib/libc/net/getnetent.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/lib/libc/net/getnetent.c b/src/lib/libc/net/getnetent.c
index fc98044a37..b16575b64d 100644
--- a/src/lib/libc/net/getnetent.c
+++ b/src/lib/libc/net/getnetent.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: getnetent.c,v 1.16 2015/01/16 18:18:58 millert Exp $ */ 1/* $OpenBSD: getnetent.c,v 1.17 2015/01/16 18:20:14 millert Exp $ */
2/* 2/*
3 * Copyright (c) 1983, 1993 3 * Copyright (c) 1983, 1993
4 * The Regents of the University of California. All rights reserved. 4 * The Regents of the University of California. All rights reserved.
@@ -86,7 +86,7 @@ again:
86 if ((cp = strchr(p, '#')) != NULL) 86 if ((cp = strchr(p, '#')) != NULL)
87 *cp = '\0'; 87 *cp = '\0';
88 net.n_name = p; 88 net.n_name = p;
89 if (strlen(net.n_name) >= HOST_NAME_MAX) 89 if (strlen(net.n_name) > HOST_NAME_MAX)
90 net.n_name[HOST_NAME_MAX] = '\0'; 90 net.n_name[HOST_NAME_MAX] = '\0';
91 cp = strpbrk(p, " \t"); 91 cp = strpbrk(p, " \t");
92 if (cp == NULL) 92 if (cp == NULL)
@@ -108,7 +108,7 @@ again:
108 } 108 }
109 if (q < &net_aliases[MAXALIASES - 1]) { 109 if (q < &net_aliases[MAXALIASES - 1]) {
110 *q++ = cp; 110 *q++ = cp;
111 if (strlen(cp) >= HOST_NAME_MAX) 111 if (strlen(cp) > HOST_NAME_MAX)
112 cp[HOST_NAME_MAX] = '\0'; 112 cp[HOST_NAME_MAX] = '\0';
113 } 113 }
114 cp = strpbrk(cp, " \t"); 114 cp = strpbrk(cp, " \t");