summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorderaadt <>2015-01-16 16:48:51 +0000
committerderaadt <>2015-01-16 16:48:51 +0000
commit1e4765ffa2cc484d6fa2c51e54ba927cbae67f13 (patch)
tree2f04e8a0f019b4b73805acf11a1e5138c9b9f37f /src/lib
parentd23934efb8e7adaa63d4eb5752505a40e4b1f285 (diff)
downloadopenbsd-1e4765ffa2cc484d6fa2c51e54ba927cbae67f13.tar.gz
openbsd-1e4765ffa2cc484d6fa2c51e54ba927cbae67f13.tar.bz2
openbsd-1e4765ffa2cc484d6fa2c51e54ba927cbae67f13.zip
Move to the <limits.h> universe.
review by millert, binary checking process with doug, concept with guenther
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/libc/crypt/arc4random.c3
-rw-r--r--src/lib/libc/crypt/crypt.c3
-rw-r--r--src/lib/libc/net/base64.c3
-rw-r--r--src/lib/libc/net/ethers.c8
-rw-r--r--src/lib/libc/net/getifaddrs.c4
-rw-r--r--src/lib/libc/net/getnetent.c12
-rw-r--r--src/lib/libc/net/herror.c3
-rw-r--r--src/lib/libc/net/inet_addr.c3
-rw-r--r--src/lib/libc/net/inet_lnaof.c3
-rw-r--r--src/lib/libc/net/inet_makeaddr.c3
-rw-r--r--src/lib/libc/net/inet_netof.c3
-rw-r--r--src/lib/libc/net/inet_ntop.c3
-rw-r--r--src/lib/libc/net/inet_pton.c3
-rw-r--r--src/lib/libc/net/ip6opt.c3
-rw-r--r--src/lib/libc/net/rcmd.c4
-rw-r--r--src/lib/libc/net/res_comp.c8
-rw-r--r--src/lib/libc/net/res_data.c3
-rw-r--r--src/lib/libc/net/rresvport.c3
-rw-r--r--src/lib/libc/net/rthdr.c3
-rw-r--r--src/lib/libc/net/ruserok.c4
-rw-r--r--src/lib/libc/stdlib/malloc.c4
-rw-r--r--src/lib/libc/stdlib/random.c5
-rw-r--r--src/lib/libc/stdlib/realpath.c6
23 files changed, 40 insertions, 57 deletions
diff --git a/src/lib/libc/crypt/arc4random.c b/src/lib/libc/crypt/arc4random.c
index 1106f06707..75cdff3bc4 100644
--- a/src/lib/libc/crypt/arc4random.c
+++ b/src/lib/libc/crypt/arc4random.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: arc4random.c,v 1.51 2015/01/15 06:57:18 deraadt Exp $ */ 1/* $OpenBSD: arc4random.c,v 1.52 2015/01/16 16:48:51 deraadt Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 1996, David Mazieres <dm@uun.org> 4 * Copyright (c) 1996, David Mazieres <dm@uun.org>
@@ -31,7 +31,6 @@
31#include <string.h> 31#include <string.h>
32#include <unistd.h> 32#include <unistd.h>
33#include <sys/types.h> 33#include <sys/types.h>
34#include <sys/param.h>
35#include <sys/time.h> 34#include <sys/time.h>
36 35
37#define KEYSTREAM_ONLY 36#define KEYSTREAM_ONLY
diff --git a/src/lib/libc/crypt/crypt.c b/src/lib/libc/crypt/crypt.c
index c7ff5d970b..7d21d4fbc3 100644
--- a/src/lib/libc/crypt/crypt.c
+++ b/src/lib/libc/crypt/crypt.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: crypt.c,v 1.25 2014/12/08 20:36:18 tedu Exp $ */ 1/* $OpenBSD: crypt.c,v 1.26 2015/01/16 16:48:51 deraadt Exp $ */
2 2
3/* 3/*
4 * FreeSec: libcrypt 4 * FreeSec: libcrypt
@@ -47,7 +47,6 @@
47 */ 47 */
48 48
49#include <sys/types.h> 49#include <sys/types.h>
50#include <sys/param.h>
51#include <pwd.h> 50#include <pwd.h>
52#include <unistd.h> 51#include <unistd.h>
53#include <string.h> 52#include <string.h>
diff --git a/src/lib/libc/net/base64.c b/src/lib/libc/net/base64.c
index 7c3d1d319f..e90696df67 100644
--- a/src/lib/libc/net/base64.c
+++ b/src/lib/libc/net/base64.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: base64.c,v 1.7 2013/12/31 02:32:56 tedu Exp $ */ 1/* $OpenBSD: base64.c,v 1.8 2015/01/16 16:48:51 deraadt Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 1996 by Internet Software Consortium. 4 * Copyright (c) 1996 by Internet Software Consortium.
@@ -43,7 +43,6 @@
43 */ 43 */
44 44
45#include <sys/types.h> 45#include <sys/types.h>
46#include <sys/param.h>
47#include <sys/socket.h> 46#include <sys/socket.h>
48#include <netinet/in.h> 47#include <netinet/in.h>
49#include <arpa/inet.h> 48#include <arpa/inet.h>
diff --git a/src/lib/libc/net/ethers.c b/src/lib/libc/net/ethers.c
index 07f1da3306..a89f0c217b 100644
--- a/src/lib/libc/net/ethers.c
+++ b/src/lib/libc/net/ethers.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ethers.c,v 1.22 2014/09/15 06:15:48 guenther Exp $ */ 1/* $OpenBSD: ethers.c,v 1.23 2015/01/16 16:48:51 deraadt Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 1998 Todd C. Miller <Todd.Miller@courtesan.com> 4 * Copyright (c) 1998 Todd C. Miller <Todd.Miller@courtesan.com>
@@ -27,13 +27,13 @@
27#include <net/if.h> 27#include <net/if.h>
28#include <netinet/in.h> 28#include <netinet/in.h>
29#include <netinet/if_ether.h> 29#include <netinet/if_ether.h>
30#include <sys/param.h>
31#include <paths.h> 30#include <paths.h>
32#include <errno.h> 31#include <errno.h>
33#include <stdio.h> 32#include <stdio.h>
34#include <stdlib.h> 33#include <stdlib.h>
35#include <string.h> 34#include <string.h>
36#include <ctype.h> 35#include <ctype.h>
36#include <limits.h>
37#ifdef YP 37#ifdef YP
38#include <rpcsvc/ypclnt.h> 38#include <rpcsvc/ypclnt.h>
39#endif 39#endif
@@ -159,7 +159,7 @@ ether_hostton(const char *hostname, struct ether_addr *e)
159{ 159{
160 FILE *f; 160 FILE *f;
161 char buf[BUFSIZ+1], *p; 161 char buf[BUFSIZ+1], *p;
162 char try[MAXHOSTNAMELEN]; 162 char try[HOST_NAME_MAX+1];
163 size_t len; 163 size_t len;
164#ifdef YP 164#ifdef YP
165 int hostlen = strlen(hostname); 165 int hostlen = strlen(hostname);
@@ -223,7 +223,7 @@ ether_line(const char *line, struct ether_addr *e, char *hostname)
223 if (*p == '\0') 223 if (*p == '\0')
224 goto bad; 224 goto bad;
225 n = strcspn(p, " \t\n"); 225 n = strcspn(p, " \t\n");
226 if (n >= MAXHOSTNAMELEN) 226 if (n >= HOST_NAME_MAX+1)
227 goto bad; 227 goto bad;
228 strlcpy(hostname, p, n + 1); 228 strlcpy(hostname, p, n + 1);
229 return (0); 229 return (0);
diff --git a/src/lib/libc/net/getifaddrs.c b/src/lib/libc/net/getifaddrs.c
index da42a23783..51dbbab871 100644
--- a/src/lib/libc/net/getifaddrs.c
+++ b/src/lib/libc/net/getifaddrs.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: getifaddrs.c,v 1.11 2013/03/20 14:15:56 deraadt Exp $ */ 1/* $OpenBSD: getifaddrs.c,v 1.12 2015/01/16 16:48:51 deraadt Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 1995, 1999 4 * Copyright (c) 1995, 1999
@@ -25,11 +25,11 @@
25 * BSDI getifaddrs.c,v 2.12 2000/02/23 14:51:59 dab Exp 25 * BSDI getifaddrs.c,v 2.12 2000/02/23 14:51:59 dab Exp
26 */ 26 */
27 27
28#include <sys/param.h> /* ALIGN */
28#include <sys/types.h> 29#include <sys/types.h>
29#include <sys/ioctl.h> 30#include <sys/ioctl.h>
30#include <sys/socket.h> 31#include <sys/socket.h>
31#include <net/if.h> 32#include <net/if.h>
32#include <sys/param.h>
33#include <net/route.h> 33#include <net/route.h>
34#include <sys/sysctl.h> 34#include <sys/sysctl.h>
35#include <net/if_dl.h> 35#include <net/if_dl.h>
diff --git a/src/lib/libc/net/getnetent.c b/src/lib/libc/net/getnetent.c
index 14c39f1482..7cda141fc0 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.14 2014/09/15 06:15:48 guenther Exp $ */ 1/* $OpenBSD: getnetent.c,v 1.15 2015/01/16 16:48:51 deraadt 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.
@@ -28,13 +28,13 @@
28 * SUCH DAMAGE. 28 * SUCH DAMAGE.
29 */ 29 */
30 30
31#include <sys/param.h>
32#include <sys/socket.h> 31#include <sys/socket.h>
33#include <netinet/in.h> 32#include <netinet/in.h>
34#include <arpa/inet.h> 33#include <arpa/inet.h>
35#include <netdb.h> 34#include <netdb.h>
36#include <stdio.h> 35#include <stdio.h>
37#include <string.h> 36#include <string.h>
37#include <limits.h>
38 38
39#define MAXALIASES 35 39#define MAXALIASES 35
40 40
@@ -86,8 +86,8 @@ 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) >= MAXHOSTNAMELEN-1) 89 if (strlen(net.n_name) >= HOST_NAME_MAX+1-1)
90 net.n_name[MAXHOSTNAMELEN-1] = '\0'; 90 net.n_name[HOST_NAME_MAX+1-1] = '\0';
91 cp = strpbrk(p, " \t"); 91 cp = strpbrk(p, " \t");
92 if (cp == NULL) 92 if (cp == NULL)
93 goto again; 93 goto again;
@@ -108,8 +108,8 @@ 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) >= MAXHOSTNAMELEN-1) 111 if (strlen(cp) >= HOST_NAME_MAX+1-1)
112 cp[MAXHOSTNAMELEN-1] = '\0'; 112 cp[HOST_NAME_MAX+1-1] = '\0';
113 } 113 }
114 cp = strpbrk(cp, " \t"); 114 cp = strpbrk(cp, " \t");
115 if (cp != NULL) 115 if (cp != NULL)
diff --git a/src/lib/libc/net/herror.c b/src/lib/libc/net/herror.c
index 7787115a9d..8dee0cc382 100644
--- a/src/lib/libc/net/herror.c
+++ b/src/lib/libc/net/herror.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: herror.c,v 1.8 2005/08/06 20:30:03 espie Exp $ */ 1/* $OpenBSD: herror.c,v 1.9 2015/01/16 16:48:51 deraadt Exp $ */
2 2
3/* 3/*
4 * ++Copyright++ 1987, 1993 4 * ++Copyright++ 1987, 1993
@@ -52,7 +52,6 @@
52 */ 52 */
53 53
54#include <sys/types.h> 54#include <sys/types.h>
55#include <sys/param.h>
56#include <sys/uio.h> 55#include <sys/uio.h>
57#include <netdb.h> 56#include <netdb.h>
58#include <unistd.h> 57#include <unistd.h>
diff --git a/src/lib/libc/net/inet_addr.c b/src/lib/libc/net/inet_addr.c
index 18762ab522..2c9aa3051b 100644
--- a/src/lib/libc/net/inet_addr.c
+++ b/src/lib/libc/net/inet_addr.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: inet_addr.c,v 1.10 2013/11/24 23:51:28 deraadt Exp $ */ 1/* $OpenBSD: inet_addr.c,v 1.11 2015/01/16 16:48:51 deraadt Exp $ */
2 2
3/* 3/*
4 * ++Copyright++ 1983, 1990, 1993 4 * ++Copyright++ 1983, 1990, 1993
@@ -52,7 +52,6 @@
52 */ 52 */
53 53
54#include <sys/types.h> 54#include <sys/types.h>
55#include <sys/param.h>
56#include <netinet/in.h> 55#include <netinet/in.h>
57#include <arpa/inet.h> 56#include <arpa/inet.h>
58#include <ctype.h> 57#include <ctype.h>
diff --git a/src/lib/libc/net/inet_lnaof.c b/src/lib/libc/net/inet_lnaof.c
index b1a58cd2c1..92845387d3 100644
--- a/src/lib/libc/net/inet_lnaof.c
+++ b/src/lib/libc/net/inet_lnaof.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: inet_lnaof.c,v 1.6 2005/08/06 20:30:03 espie Exp $ */ 1/* $OpenBSD: inet_lnaof.c,v 1.7 2015/01/16 16:48:51 deraadt 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.
@@ -28,7 +28,6 @@
28 * SUCH DAMAGE. 28 * SUCH DAMAGE.
29 */ 29 */
30 30
31#include <sys/param.h>
32#include <netinet/in.h> 31#include <netinet/in.h>
33#include <arpa/inet.h> 32#include <arpa/inet.h>
34 33
diff --git a/src/lib/libc/net/inet_makeaddr.c b/src/lib/libc/net/inet_makeaddr.c
index 87d9325231..88ddd2850e 100644
--- a/src/lib/libc/net/inet_makeaddr.c
+++ b/src/lib/libc/net/inet_makeaddr.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: inet_makeaddr.c,v 1.6 2005/08/06 20:30:03 espie Exp $ */ 1/* $OpenBSD: inet_makeaddr.c,v 1.7 2015/01/16 16:48:51 deraadt 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.
@@ -28,7 +28,6 @@
28 * SUCH DAMAGE. 28 * SUCH DAMAGE.
29 */ 29 */
30 30
31#include <sys/param.h>
32#include <netinet/in.h> 31#include <netinet/in.h>
33#include <arpa/inet.h> 32#include <arpa/inet.h>
34 33
diff --git a/src/lib/libc/net/inet_netof.c b/src/lib/libc/net/inet_netof.c
index 2f468c3aca..4efceede13 100644
--- a/src/lib/libc/net/inet_netof.c
+++ b/src/lib/libc/net/inet_netof.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: inet_netof.c,v 1.6 2005/08/06 20:30:03 espie Exp $ */ 1/* $OpenBSD: inet_netof.c,v 1.7 2015/01/16 16:48:51 deraadt 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.
@@ -28,7 +28,6 @@
28 * SUCH DAMAGE. 28 * SUCH DAMAGE.
29 */ 29 */
30 30
31#include <sys/param.h>
32#include <netinet/in.h> 31#include <netinet/in.h>
33#include <arpa/inet.h> 32#include <arpa/inet.h>
34 33
diff --git a/src/lib/libc/net/inet_ntop.c b/src/lib/libc/net/inet_ntop.c
index f991a071ba..722761e2ed 100644
--- a/src/lib/libc/net/inet_ntop.c
+++ b/src/lib/libc/net/inet_ntop.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: inet_ntop.c,v 1.10 2014/05/17 18:16:14 tedu Exp $ */ 1/* $OpenBSD: inet_ntop.c,v 1.11 2015/01/16 16:48:51 deraadt Exp $ */
2 2
3/* Copyright (c) 1996 by Internet Software Consortium. 3/* Copyright (c) 1996 by Internet Software Consortium.
4 * 4 *
@@ -16,7 +16,6 @@
16 * SOFTWARE. 16 * SOFTWARE.
17 */ 17 */
18 18
19#include <sys/param.h>
20#include <sys/types.h> 19#include <sys/types.h>
21#include <sys/socket.h> 20#include <sys/socket.h>
22#include <netinet/in.h> 21#include <netinet/in.h>
diff --git a/src/lib/libc/net/inet_pton.c b/src/lib/libc/net/inet_pton.c
index 7e521c3286..f8e299b7b8 100644
--- a/src/lib/libc/net/inet_pton.c
+++ b/src/lib/libc/net/inet_pton.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: inet_pton.c,v 1.8 2010/05/06 15:47:14 claudio Exp $ */ 1/* $OpenBSD: inet_pton.c,v 1.9 2015/01/16 16:48:51 deraadt Exp $ */
2 2
3/* Copyright (c) 1996 by Internet Software Consortium. 3/* Copyright (c) 1996 by Internet Software Consortium.
4 * 4 *
@@ -16,7 +16,6 @@
16 * SOFTWARE. 16 * SOFTWARE.
17 */ 17 */
18 18
19#include <sys/param.h>
20#include <sys/types.h> 19#include <sys/types.h>
21#include <sys/socket.h> 20#include <sys/socket.h>
22#include <netinet/in.h> 21#include <netinet/in.h>
diff --git a/src/lib/libc/net/ip6opt.c b/src/lib/libc/net/ip6opt.c
index d98e300cb6..71dfe55803 100644
--- a/src/lib/libc/net/ip6opt.c
+++ b/src/lib/libc/net/ip6opt.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ip6opt.c,v 1.7 2014/06/13 15:41:06 chrisz Exp $ */ 1/* $OpenBSD: ip6opt.c,v 1.8 2015/01/16 16:48:51 deraadt Exp $ */
2/* $KAME: ip6opt.c,v 1.18 2005/06/15 07:11:35 keiichi Exp $ */ 2/* $KAME: ip6opt.c,v 1.18 2005/06/15 07:11:35 keiichi Exp $ */
3 3
4/* 4/*
@@ -30,7 +30,6 @@
30 * SUCH DAMAGE. 30 * SUCH DAMAGE.
31 */ 31 */
32 32
33#include <sys/param.h>
34#include <sys/types.h> 33#include <sys/types.h>
35#include <sys/socket.h> 34#include <sys/socket.h>
36 35
diff --git a/src/lib/libc/net/rcmd.c b/src/lib/libc/net/rcmd.c
index 617fe440aa..afa59dde97 100644
--- a/src/lib/libc/net/rcmd.c
+++ b/src/lib/libc/net/rcmd.c
@@ -28,7 +28,6 @@
28 * SUCH DAMAGE. 28 * SUCH DAMAGE.
29 */ 29 */
30 30
31#include <sys/param.h>
32#include <sys/socket.h> 31#include <sys/socket.h>
33#include <sys/stat.h> 32#include <sys/stat.h>
34 33
@@ -39,6 +38,7 @@
39#include <fcntl.h> 38#include <fcntl.h>
40#include <netdb.h> 39#include <netdb.h>
41#include <unistd.h> 40#include <unistd.h>
41#include <limits.h>
42#include <pwd.h> 42#include <pwd.h>
43#include <errno.h> 43#include <errno.h>
44#include <stdio.h> 44#include <stdio.h>
@@ -59,7 +59,7 @@ int
59rcmd_af(char **ahost, int porta, const char *locuser, const char *remuser, 59rcmd_af(char **ahost, int porta, const char *locuser, const char *remuser,
60 const char *cmd, int *fd2p, int af) 60 const char *cmd, int *fd2p, int af)
61{ 61{
62 static char hbuf[MAXHOSTNAMELEN]; 62 static char hbuf[HOST_NAME_MAX+1];
63 char pbuf[NI_MAXSERV]; 63 char pbuf[NI_MAXSERV];
64 struct addrinfo hints, *res, *r; 64 struct addrinfo hints, *res, *r;
65 int error; 65 int error;
diff --git a/src/lib/libc/net/res_comp.c b/src/lib/libc/net/res_comp.c
index 69a6ce0abb..37c8f23dc2 100644
--- a/src/lib/libc/net/res_comp.c
+++ b/src/lib/libc/net/res_comp.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: res_comp.c,v 1.14 2008/04/16 22:35:23 deraadt Exp $ */ 1/* $OpenBSD: res_comp.c,v 1.15 2015/01/16 16:48:51 deraadt Exp $ */
2 2
3/* 3/*
4 * ++Copyright++ 1985, 1993 4 * ++Copyright++ 1985, 1993
@@ -52,7 +52,6 @@
52 */ 52 */
53 53
54#include <sys/types.h> 54#include <sys/types.h>
55#include <sys/param.h>
56#include <netinet/in.h> 55#include <netinet/in.h>
57#include <arpa/nameser.h> 56#include <arpa/nameser.h>
58 57
@@ -61,6 +60,7 @@
61#include <ctype.h> 60#include <ctype.h>
62 61
63#include <unistd.h> 62#include <unistd.h>
63#include <limits.h>
64#include <string.h> 64#include <string.h>
65 65
66static int dn_find(u_char *, u_char *, u_char **, u_char **); 66static 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,
84 84
85 dn = exp_dn; 85 dn = exp_dn;
86 cp = comp_dn; 86 cp = comp_dn;
87 if (length > MAXHOSTNAMELEN-1) 87 if (length > HOST_NAME_MAX+1-1)
88 length = MAXHOSTNAMELEN-1; 88 length = HOST_NAME_MAX+1-1;
89 eom = exp_dn + length; 89 eom = exp_dn + length;
90 /* 90 /*
91 * fetch next label in domain name 91 * fetch next label in domain name
diff --git a/src/lib/libc/net/res_data.c b/src/lib/libc/net/res_data.c
index a5f6b03a7f..6e81b584a9 100644
--- a/src/lib/libc/net/res_data.c
+++ b/src/lib/libc/net/res_data.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: res_data.c,v 1.3 2005/08/06 20:30:03 espie Exp $ */ 1/* $OpenBSD: res_data.c,v 1.4 2015/01/16 16:48:51 deraadt Exp $ */
2 2
3/* 3/*
4 * ++Copyright++ 1995 4 * ++Copyright++ 1995
@@ -52,7 +52,6 @@
52 */ 52 */
53 53
54#include <sys/types.h> 54#include <sys/types.h>
55#include <sys/param.h>
56#include <sys/socket.h> 55#include <sys/socket.h>
57#include <sys/time.h> 56#include <sys/time.h>
58#include <netinet/in.h> 57#include <netinet/in.h>
diff --git a/src/lib/libc/net/rresvport.c b/src/lib/libc/net/rresvport.c
index ccc411500b..2ecbc0a67d 100644
--- a/src/lib/libc/net/rresvport.c
+++ b/src/lib/libc/net/rresvport.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: rresvport.c,v 1.9 2005/11/10 10:00:17 espie Exp $ */ 1/* $OpenBSD: rresvport.c,v 1.10 2015/01/16 16:48:51 deraadt Exp $ */
2/* 2/*
3 * Copyright (c) 1995, 1996, 1998 Theo de Raadt. All rights reserved. 3 * Copyright (c) 1995, 1996, 1998 Theo de Raadt. All rights reserved.
4 * Copyright (c) 1983, 1993, 1994 4 * Copyright (c) 1983, 1993, 1994
@@ -29,7 +29,6 @@
29 * SUCH DAMAGE. 29 * SUCH DAMAGE.
30 */ 30 */
31 31
32#include <sys/param.h>
33#include <sys/socket.h> 32#include <sys/socket.h>
34#include <sys/stat.h> 33#include <sys/stat.h>
35 34
diff --git a/src/lib/libc/net/rthdr.c b/src/lib/libc/net/rthdr.c
index 9e917f1009..92a1f75a76 100644
--- a/src/lib/libc/net/rthdr.c
+++ b/src/lib/libc/net/rthdr.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: rthdr.c,v 1.9 2014/06/13 15:41:06 chrisz Exp $ */ 1/* $OpenBSD: rthdr.c,v 1.10 2015/01/16 16:48:51 deraadt Exp $ */
2/* $KAME: rthdr.c,v 1.22 2006/02/09 08:18:58 keiichi Exp $ */ 2/* $KAME: rthdr.c,v 1.22 2006/02/09 08:18:58 keiichi Exp $ */
3 3
4/* 4/*
@@ -30,7 +30,6 @@
30 * SUCH DAMAGE. 30 * SUCH DAMAGE.
31 */ 31 */
32 32
33#include <sys/param.h>
34#include <sys/types.h> 33#include <sys/types.h>
35#include <sys/socket.h> 34#include <sys/socket.h>
36 35
diff --git a/src/lib/libc/net/ruserok.c b/src/lib/libc/net/ruserok.c
index 4d0adfbe4e..fed55e031d 100644
--- a/src/lib/libc/net/ruserok.c
+++ b/src/lib/libc/net/ruserok.c
@@ -204,7 +204,7 @@ __ivaliduser_sa(FILE *hostf, struct sockaddr *raddr, socklen_t salen,
204 const char *auser, *ahost; 204 const char *auser, *ahost;
205 int hostok, userok; 205 int hostok, userok;
206 char *rhost = (char *)-1; 206 char *rhost = (char *)-1;
207 char domain[MAXHOSTNAMELEN]; 207 char domain[HOST_NAME_MAX+1];
208 size_t buflen; 208 size_t buflen;
209 209
210 getdomainname(domain, sizeof(domain)); 210 getdomainname(domain, sizeof(domain));
@@ -245,7 +245,7 @@ __ivaliduser_sa(FILE *hostf, struct sockaddr *raddr, socklen_t salen,
245 auser = *user ? user : luser; 245 auser = *user ? user : luser;
246 ahost = buf; 246 ahost = buf;
247 247
248 if (strlen(ahost) >= MAXHOSTNAMELEN) 248 if (strlen(ahost) >= HOST_NAME_MAX+1)
249 continue; 249 continue;
250 250
251 /* 251 /*
diff --git a/src/lib/libc/stdlib/malloc.c b/src/lib/libc/stdlib/malloc.c
index 57d35b80b6..69ae877aba 100644
--- a/src/lib/libc/stdlib/malloc.c
+++ b/src/lib/libc/stdlib/malloc.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: malloc.c,v 1.172 2015/01/05 21:04:04 tedu Exp $ */ 1/* $OpenBSD: malloc.c,v 1.173 2015/01/16 16:48:51 deraadt Exp $ */
2/* 2/*
3 * Copyright (c) 2008, 2010, 2011 Otto Moerbeek <otto@drijf.net> 3 * Copyright (c) 2008, 2010, 2011 Otto Moerbeek <otto@drijf.net>
4 * Copyright (c) 2012 Matthew Dempsky <matthew@openbsd.org> 4 * Copyright (c) 2012 Matthew Dempsky <matthew@openbsd.org>
@@ -26,7 +26,7 @@
26/* #define MALLOC_STATS */ 26/* #define MALLOC_STATS */
27 27
28#include <sys/types.h> 28#include <sys/types.h>
29#include <sys/param.h> 29#include <sys/param.h> /* PAGE_SHIFT ALIGN */
30#include <sys/queue.h> 30#include <sys/queue.h>
31#include <sys/mman.h> 31#include <sys/mman.h>
32#include <sys/uio.h> 32#include <sys/uio.h>
diff --git a/src/lib/libc/stdlib/random.c b/src/lib/libc/stdlib/random.c
index 96cced9a20..e293648ecd 100644
--- a/src/lib/libc/stdlib/random.c
+++ b/src/lib/libc/stdlib/random.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: random.c,v 1.28 2014/12/16 20:51:32 sthen Exp $ */ 1/* $OpenBSD: random.c,v 1.29 2015/01/16 16:48:51 deraadt Exp $ */
2/* 2/*
3 * Copyright (c) 1983 Regents of the University of California. 3 * Copyright (c) 1983 Regents of the University of California.
4 * All rights reserved. 4 * All rights reserved.
@@ -28,9 +28,6 @@
28 * SUCH DAMAGE. 28 * SUCH DAMAGE.
29 */ 29 */
30 30
31#include <sys/param.h>
32#include <sys/sysctl.h>
33#include <sys/time.h>
34#include <fcntl.h> 31#include <fcntl.h>
35#include <stdio.h> 32#include <stdio.h>
36#include <stdlib.h> 33#include <stdlib.h>
diff --git a/src/lib/libc/stdlib/realpath.c b/src/lib/libc/stdlib/realpath.c
index e06db59088..7b70b9ddfb 100644
--- a/src/lib/libc/stdlib/realpath.c
+++ b/src/lib/libc/stdlib/realpath.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: realpath.c,v 1.18 2014/10/19 03:56:28 doug Exp $ */ 1/* $OpenBSD: realpath.c,v 1.19 2015/01/16 16:48:51 deraadt Exp $ */
2/* 2/*
3 * Copyright (c) 2003 Constantin S. Svintsoff <kostik@iclub.nsu.ru> 3 * Copyright (c) 2003 Constantin S. Svintsoff <kostik@iclub.nsu.ru>
4 * 4 *
@@ -27,13 +27,13 @@
27 * SUCH DAMAGE. 27 * SUCH DAMAGE.
28 */ 28 */
29 29
30#include <sys/param.h>
31#include <sys/stat.h> 30#include <sys/stat.h>
32 31
33#include <errno.h> 32#include <errno.h>
34#include <stdlib.h> 33#include <stdlib.h>
35#include <string.h> 34#include <string.h>
36#include <unistd.h> 35#include <unistd.h>
36#include <limits.h>
37 37
38/* A slightly modified copy of this file exists in libexec/ld.so */ 38/* A slightly modified copy of this file exists in libexec/ld.so */
39 39
@@ -156,7 +156,7 @@ realpath(const char *path, char *resolved)
156 goto err; 156 goto err;
157 } 157 }
158 if (S_ISLNK(sb.st_mode)) { 158 if (S_ISLNK(sb.st_mode)) {
159 if (symlinks++ > MAXSYMLINKS) { 159 if (symlinks++ > SYMLOOP_MAX) {
160 errno = ELOOP; 160 errno = ELOOP;
161 goto err; 161 goto err;
162 } 162 }