From: millert Date: Fri, 16 Jan 2015 18:18:58 +0000 (+0000) Subject: Replace HOST_NAME_MAX+1-1 with HOST_NAME_MAX. OK deraad@ X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=8cdb393c787dfeee93fb2eb5729fddc1c22361d0;p=openbsd Replace HOST_NAME_MAX+1-1 with HOST_NAME_MAX. OK deraad@ --- 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