Replace HOST_NAME_MAX+1-1 with HOST_NAME_MAX. OK deraad@
authormillert <millert@openbsd.org>
Fri, 16 Jan 2015 18:18:58 +0000 (18:18 +0000)
committermillert <millert@openbsd.org>
Fri, 16 Jan 2015 18:18:58 +0000 (18:18 +0000)
lib/libc/gen/sysconf.c
lib/libc/net/getnetent.c
lib/libc/net/res_comp.c

index ef67c24..bdf99a1 100644 (file)
@@ -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:
index 7cda141..fc98044 100644 (file)
@@ -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)
index 37c8f23..a1467c3 100644 (file)
@@ -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