summaryrefslogtreecommitdiffstats
path: root/lib/libc
diff options
context:
space:
mode:
authormillert <millert@openbsd.org>2015-01-16 18:18:58 +0000
committermillert <millert@openbsd.org>2015-01-16 18:18:58 +0000
commit8cdb393c787dfeee93fb2eb5729fddc1c22361d0 (patch)
tree72f887c9b5a5e258ae442a31a9f06d2d27380a52 /lib/libc
parentReplace check for ">= HOST_NAME_MAX+1" with "> HOST_NAME_MAX". (diff)
downloadwireguard-openbsd-8cdb393c787dfeee93fb2eb5729fddc1c22361d0.tar.xz
wireguard-openbsd-8cdb393c787dfeee93fb2eb5729fddc1c22361d0.zip
Replace HOST_NAME_MAX+1-1 with HOST_NAME_MAX. OK deraad@
Diffstat (limited to 'lib/libc')
-rw-r--r--lib/libc/gen/sysconf.c4
-rw-r--r--lib/libc/net/getnetent.c10
-rw-r--r--lib/libc/net/res_comp.c6
3 files changed, 10 insertions, 10 deletions
diff --git a/lib/libc/gen/sysconf.c b/lib/libc/gen/sysconf.c
index ef67c24e0dc..bdf99a17711 100644
--- a/lib/libc/gen/sysconf.c
+++ b/lib/libc/gen/sysconf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sysconf.c,v 1.21 2015/01/16 16:48:51 deraadt Exp $ */
+/* $OpenBSD: sysconf.c,v 1.22 2015/01/16 18:18:58 millert Exp $ */
/*-
* Copyright (c) 1993
* The Regents of the University of California. All rights reserved.
@@ -203,7 +203,7 @@ sysconf(int name)
/* Unsorted */
case _SC_HOST_NAME_MAX:
- return (HOST_NAME_MAX+1 - 1); /* does not include \0 */
+ return (HOST_NAME_MAX); /* does not include \0 */
case _SC_MONOTONIC_CLOCK:
return (_POSIX_MONOTONIC_CLOCK);
case _SC_2_PBS:
diff --git a/lib/libc/net/getnetent.c b/lib/libc/net/getnetent.c
index 7cda141fc0e..fc98044a37b 100644
--- a/lib/libc/net/getnetent.c
+++ b/lib/libc/net/getnetent.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: getnetent.c,v 1.15 2015/01/16 16:48:51 deraadt Exp $ */
+/* $OpenBSD: getnetent.c,v 1.16 2015/01/16 18:18:58 millert Exp $ */
/*
* Copyright (c) 1983, 1993
* The Regents of the University of California. All rights reserved.
@@ -86,8 +86,8 @@ again:
if ((cp = strchr(p, '#')) != NULL)
*cp = '\0';
net.n_name = p;
- if (strlen(net.n_name) >= HOST_NAME_MAX+1-1)
- net.n_name[HOST_NAME_MAX+1-1] = '\0';
+ if (strlen(net.n_name) >= HOST_NAME_MAX)
+ net.n_name[HOST_NAME_MAX] = '\0';
cp = strpbrk(p, " \t");
if (cp == NULL)
goto again;
@@ -108,8 +108,8 @@ again:
}
if (q < &net_aliases[MAXALIASES - 1]) {
*q++ = cp;
- if (strlen(cp) >= HOST_NAME_MAX+1-1)
- cp[HOST_NAME_MAX+1-1] = '\0';
+ if (strlen(cp) >= HOST_NAME_MAX)
+ cp[HOST_NAME_MAX] = '\0';
}
cp = strpbrk(cp, " \t");
if (cp != NULL)
diff --git a/lib/libc/net/res_comp.c b/lib/libc/net/res_comp.c
index 37c8f23dc2b..a1467c3dbb7 100644
--- a/lib/libc/net/res_comp.c
+++ b/lib/libc/net/res_comp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: res_comp.c,v 1.15 2015/01/16 16:48:51 deraadt Exp $ */
+/* $OpenBSD: res_comp.c,v 1.16 2015/01/16 18:18:58 millert Exp $ */
/*
* ++Copyright++ 1985, 1993
@@ -84,8 +84,8 @@ dn_expand(const u_char *msg, const u_char *eomorig, const u_char *comp_dn,
dn = exp_dn;
cp = comp_dn;
- if (length > HOST_NAME_MAX+1-1)
- length = HOST_NAME_MAX+1-1;
+ if (length > HOST_NAME_MAX)
+ length = HOST_NAME_MAX;
eom = exp_dn + length;
/*
* fetch next label in domain name