From 94fa34c725ef755eb123686f6cbdceb24411e401 Mon Sep 17 00:00:00 2001 From: Theo de Raadt Date: Fri, 16 Jan 2015 16:48:53 +0000 Subject: Move to the universe. review by millert, binary checking process with doug, concept with guenther --- lib/libc/net/base64.c | 3 +-- lib/libc/net/ethers.c | 8 ++++---- lib/libc/net/getifaddrs.c | 4 ++-- lib/libc/net/getnetent.c | 12 ++++++------ lib/libc/net/herror.c | 3 +-- lib/libc/net/inet_addr.c | 3 +-- lib/libc/net/inet_lnaof.c | 3 +-- lib/libc/net/inet_makeaddr.c | 3 +-- lib/libc/net/inet_netof.c | 3 +-- lib/libc/net/inet_ntop.c | 3 +-- lib/libc/net/inet_pton.c | 3 +-- lib/libc/net/ip6opt.c | 3 +-- lib/libc/net/rcmd.c | 4 ++-- lib/libc/net/res_comp.c | 8 ++++---- lib/libc/net/res_data.c | 3 +-- lib/libc/net/rresvport.c | 3 +-- lib/libc/net/rthdr.c | 3 +-- lib/libc/net/ruserok.c | 4 ++-- 18 files changed, 32 insertions(+), 44 deletions(-) (limited to 'lib/libc/net') diff --git a/lib/libc/net/base64.c b/lib/libc/net/base64.c index 7c3d1d319f6..e90696df673 100644 --- a/lib/libc/net/base64.c +++ b/lib/libc/net/base64.c @@ -1,4 +1,4 @@ -/* $OpenBSD: base64.c,v 1.7 2013/12/31 02:32:56 tedu Exp $ */ +/* $OpenBSD: base64.c,v 1.8 2015/01/16 16:48:51 deraadt Exp $ */ /* * Copyright (c) 1996 by Internet Software Consortium. @@ -43,7 +43,6 @@ */ #include -#include #include #include #include diff --git a/lib/libc/net/ethers.c b/lib/libc/net/ethers.c index 07f1da33066..a89f0c217bf 100644 --- a/lib/libc/net/ethers.c +++ b/lib/libc/net/ethers.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ethers.c,v 1.22 2014/09/15 06:15:48 guenther Exp $ */ +/* $OpenBSD: ethers.c,v 1.23 2015/01/16 16:48:51 deraadt Exp $ */ /* * Copyright (c) 1998 Todd C. Miller @@ -27,13 +27,13 @@ #include #include #include -#include #include #include #include #include #include #include +#include #ifdef YP #include #endif @@ -159,7 +159,7 @@ ether_hostton(const char *hostname, struct ether_addr *e) { FILE *f; char buf[BUFSIZ+1], *p; - char try[MAXHOSTNAMELEN]; + char try[HOST_NAME_MAX+1]; size_t len; #ifdef YP int hostlen = strlen(hostname); @@ -223,7 +223,7 @@ ether_line(const char *line, struct ether_addr *e, char *hostname) if (*p == '\0') goto bad; n = strcspn(p, " \t\n"); - if (n >= MAXHOSTNAMELEN) + if (n >= HOST_NAME_MAX+1) goto bad; strlcpy(hostname, p, n + 1); return (0); diff --git a/lib/libc/net/getifaddrs.c b/lib/libc/net/getifaddrs.c index da42a23783e..51dbbab8717 100644 --- a/lib/libc/net/getifaddrs.c +++ b/lib/libc/net/getifaddrs.c @@ -1,4 +1,4 @@ -/* $OpenBSD: getifaddrs.c,v 1.11 2013/03/20 14:15:56 deraadt Exp $ */ +/* $OpenBSD: getifaddrs.c,v 1.12 2015/01/16 16:48:51 deraadt Exp $ */ /* * Copyright (c) 1995, 1999 @@ -25,11 +25,11 @@ * BSDI getifaddrs.c,v 2.12 2000/02/23 14:51:59 dab Exp */ +#include /* ALIGN */ #include #include #include #include -#include #include #include #include diff --git a/lib/libc/net/getnetent.c b/lib/libc/net/getnetent.c index 14c39f1482f..7cda141fc0e 100644 --- a/lib/libc/net/getnetent.c +++ b/lib/libc/net/getnetent.c @@ -1,4 +1,4 @@ -/* $OpenBSD: getnetent.c,v 1.14 2014/09/15 06:15:48 guenther Exp $ */ +/* $OpenBSD: getnetent.c,v 1.15 2015/01/16 16:48:51 deraadt Exp $ */ /* * Copyright (c) 1983, 1993 * The Regents of the University of California. All rights reserved. @@ -28,13 +28,13 @@ * SUCH DAMAGE. */ -#include #include #include #include #include #include #include +#include #define MAXALIASES 35 @@ -86,8 +86,8 @@ again: if ((cp = strchr(p, '#')) != NULL) *cp = '\0'; net.n_name = p; - if (strlen(net.n_name) >= MAXHOSTNAMELEN-1) - net.n_name[MAXHOSTNAMELEN-1] = '\0'; + if (strlen(net.n_name) >= HOST_NAME_MAX+1-1) + net.n_name[HOST_NAME_MAX+1-1] = '\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) >= MAXHOSTNAMELEN-1) - cp[MAXHOSTNAMELEN-1] = '\0'; + if (strlen(cp) >= HOST_NAME_MAX+1-1) + cp[HOST_NAME_MAX+1-1] = '\0'; } cp = strpbrk(cp, " \t"); if (cp != NULL) diff --git a/lib/libc/net/herror.c b/lib/libc/net/herror.c index 7787115a9da..8dee0cc382e 100644 --- a/lib/libc/net/herror.c +++ b/lib/libc/net/herror.c @@ -1,4 +1,4 @@ -/* $OpenBSD: herror.c,v 1.8 2005/08/06 20:30:03 espie Exp $ */ +/* $OpenBSD: herror.c,v 1.9 2015/01/16 16:48:51 deraadt Exp $ */ /* * ++Copyright++ 1987, 1993 @@ -52,7 +52,6 @@ */ #include -#include #include #include #include diff --git a/lib/libc/net/inet_addr.c b/lib/libc/net/inet_addr.c index 18762ab5223..2c9aa3051b6 100644 --- a/lib/libc/net/inet_addr.c +++ b/lib/libc/net/inet_addr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: inet_addr.c,v 1.10 2013/11/24 23:51:28 deraadt Exp $ */ +/* $OpenBSD: inet_addr.c,v 1.11 2015/01/16 16:48:51 deraadt Exp $ */ /* * ++Copyright++ 1983, 1990, 1993 @@ -52,7 +52,6 @@ */ #include -#include #include #include #include diff --git a/lib/libc/net/inet_lnaof.c b/lib/libc/net/inet_lnaof.c index b1a58cd2c19..92845387d37 100644 --- a/lib/libc/net/inet_lnaof.c +++ b/lib/libc/net/inet_lnaof.c @@ -1,4 +1,4 @@ -/* $OpenBSD: inet_lnaof.c,v 1.6 2005/08/06 20:30:03 espie Exp $ */ +/* $OpenBSD: inet_lnaof.c,v 1.7 2015/01/16 16:48:51 deraadt Exp $ */ /* * Copyright (c) 1983, 1993 * The Regents of the University of California. All rights reserved. @@ -28,7 +28,6 @@ * SUCH DAMAGE. */ -#include #include #include diff --git a/lib/libc/net/inet_makeaddr.c b/lib/libc/net/inet_makeaddr.c index 87d9325231d..88ddd2850ec 100644 --- a/lib/libc/net/inet_makeaddr.c +++ b/lib/libc/net/inet_makeaddr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: inet_makeaddr.c,v 1.6 2005/08/06 20:30:03 espie Exp $ */ +/* $OpenBSD: inet_makeaddr.c,v 1.7 2015/01/16 16:48:51 deraadt Exp $ */ /* * Copyright (c) 1983, 1993 * The Regents of the University of California. All rights reserved. @@ -28,7 +28,6 @@ * SUCH DAMAGE. */ -#include #include #include diff --git a/lib/libc/net/inet_netof.c b/lib/libc/net/inet_netof.c index 2f468c3aca5..4efceede132 100644 --- a/lib/libc/net/inet_netof.c +++ b/lib/libc/net/inet_netof.c @@ -1,4 +1,4 @@ -/* $OpenBSD: inet_netof.c,v 1.6 2005/08/06 20:30:03 espie Exp $ */ +/* $OpenBSD: inet_netof.c,v 1.7 2015/01/16 16:48:51 deraadt Exp $ */ /* * Copyright (c) 1983, 1993 * The Regents of the University of California. All rights reserved. @@ -28,7 +28,6 @@ * SUCH DAMAGE. */ -#include #include #include diff --git a/lib/libc/net/inet_ntop.c b/lib/libc/net/inet_ntop.c index f991a071bab..722761e2ed9 100644 --- a/lib/libc/net/inet_ntop.c +++ b/lib/libc/net/inet_ntop.c @@ -1,4 +1,4 @@ -/* $OpenBSD: inet_ntop.c,v 1.10 2014/05/17 18:16:14 tedu Exp $ */ +/* $OpenBSD: inet_ntop.c,v 1.11 2015/01/16 16:48:51 deraadt Exp $ */ /* Copyright (c) 1996 by Internet Software Consortium. * @@ -16,7 +16,6 @@ * SOFTWARE. */ -#include #include #include #include diff --git a/lib/libc/net/inet_pton.c b/lib/libc/net/inet_pton.c index 7e521c32867..f8e299b7b8a 100644 --- a/lib/libc/net/inet_pton.c +++ b/lib/libc/net/inet_pton.c @@ -1,4 +1,4 @@ -/* $OpenBSD: inet_pton.c,v 1.8 2010/05/06 15:47:14 claudio Exp $ */ +/* $OpenBSD: inet_pton.c,v 1.9 2015/01/16 16:48:51 deraadt Exp $ */ /* Copyright (c) 1996 by Internet Software Consortium. * @@ -16,7 +16,6 @@ * SOFTWARE. */ -#include #include #include #include diff --git a/lib/libc/net/ip6opt.c b/lib/libc/net/ip6opt.c index d98e300cb62..71dfe558031 100644 --- a/lib/libc/net/ip6opt.c +++ b/lib/libc/net/ip6opt.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ip6opt.c,v 1.7 2014/06/13 15:41:06 chrisz Exp $ */ +/* $OpenBSD: ip6opt.c,v 1.8 2015/01/16 16:48:51 deraadt Exp $ */ /* $KAME: ip6opt.c,v 1.18 2005/06/15 07:11:35 keiichi Exp $ */ /* @@ -30,7 +30,6 @@ * SUCH DAMAGE. */ -#include #include #include diff --git a/lib/libc/net/rcmd.c b/lib/libc/net/rcmd.c index 617fe440aa0..afa59dde973 100644 --- a/lib/libc/net/rcmd.c +++ b/lib/libc/net/rcmd.c @@ -28,7 +28,6 @@ * SUCH DAMAGE. */ -#include #include #include @@ -39,6 +38,7 @@ #include #include #include +#include #include #include #include @@ -59,7 +59,7 @@ int rcmd_af(char **ahost, int porta, const char *locuser, const char *remuser, const char *cmd, int *fd2p, int af) { - static char hbuf[MAXHOSTNAMELEN]; + static char hbuf[HOST_NAME_MAX+1]; char pbuf[NI_MAXSERV]; struct addrinfo hints, *res, *r; int error; diff --git a/lib/libc/net/res_comp.c b/lib/libc/net/res_comp.c index 69a6ce0abbb..37c8f23dc2b 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.14 2008/04/16 22:35:23 deraadt Exp $ */ +/* $OpenBSD: res_comp.c,v 1.15 2015/01/16 16:48:51 deraadt Exp $ */ /* * ++Copyright++ 1985, 1993 @@ -52,7 +52,6 @@ */ #include -#include #include #include @@ -61,6 +60,7 @@ #include #include +#include #include static int dn_find(u_char *, u_char *, u_char **, u_char **); @@ -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 > MAXHOSTNAMELEN-1) - length = MAXHOSTNAMELEN-1; + if (length > HOST_NAME_MAX+1-1) + length = HOST_NAME_MAX+1-1; eom = exp_dn + length; /* * fetch next label in domain name diff --git a/lib/libc/net/res_data.c b/lib/libc/net/res_data.c index a5f6b03a7f7..6e81b584a9f 100644 --- a/lib/libc/net/res_data.c +++ b/lib/libc/net/res_data.c @@ -1,4 +1,4 @@ -/* $OpenBSD: res_data.c,v 1.3 2005/08/06 20:30:03 espie Exp $ */ +/* $OpenBSD: res_data.c,v 1.4 2015/01/16 16:48:51 deraadt Exp $ */ /* * ++Copyright++ 1995 @@ -52,7 +52,6 @@ */ #include -#include #include #include #include diff --git a/lib/libc/net/rresvport.c b/lib/libc/net/rresvport.c index ccc411500b8..2ecbc0a67d6 100644 --- a/lib/libc/net/rresvport.c +++ b/lib/libc/net/rresvport.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rresvport.c,v 1.9 2005/11/10 10:00:17 espie Exp $ */ +/* $OpenBSD: rresvport.c,v 1.10 2015/01/16 16:48:51 deraadt Exp $ */ /* * Copyright (c) 1995, 1996, 1998 Theo de Raadt. All rights reserved. * Copyright (c) 1983, 1993, 1994 @@ -29,7 +29,6 @@ * SUCH DAMAGE. */ -#include #include #include diff --git a/lib/libc/net/rthdr.c b/lib/libc/net/rthdr.c index 9e917f1009a..92a1f75a769 100644 --- a/lib/libc/net/rthdr.c +++ b/lib/libc/net/rthdr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rthdr.c,v 1.9 2014/06/13 15:41:06 chrisz Exp $ */ +/* $OpenBSD: rthdr.c,v 1.10 2015/01/16 16:48:51 deraadt Exp $ */ /* $KAME: rthdr.c,v 1.22 2006/02/09 08:18:58 keiichi Exp $ */ /* @@ -30,7 +30,6 @@ * SUCH DAMAGE. */ -#include #include #include diff --git a/lib/libc/net/ruserok.c b/lib/libc/net/ruserok.c index 4d0adfbe4ef..fed55e031d0 100644 --- a/lib/libc/net/ruserok.c +++ b/lib/libc/net/ruserok.c @@ -204,7 +204,7 @@ __ivaliduser_sa(FILE *hostf, struct sockaddr *raddr, socklen_t salen, const char *auser, *ahost; int hostok, userok; char *rhost = (char *)-1; - char domain[MAXHOSTNAMELEN]; + char domain[HOST_NAME_MAX+1]; size_t buflen; getdomainname(domain, sizeof(domain)); @@ -245,7 +245,7 @@ __ivaliduser_sa(FILE *hostf, struct sockaddr *raddr, socklen_t salen, auser = *user ? user : luser; ahost = buf; - if (strlen(ahost) >= MAXHOSTNAMELEN) + if (strlen(ahost) >= HOST_NAME_MAX+1) continue; /* -- cgit v1.2.3