summaryrefslogtreecommitdiffstats
path: root/lib/libc/net/getnetent.c
diff options
context:
space:
mode:
authorderaadt <deraadt@openbsd.org>2015-01-16 16:48:51 +0000
committerderaadt <deraadt@openbsd.org>2015-01-16 16:48:51 +0000
commitaea60bee5e9bad0aab62f480f19c2fb34c068de4 (patch)
tree1e7befbc10e28796528939427d4fdbd94b60d9af /lib/libc/net/getnetent.c
parentMore evil bootstrap code. #ifndef ALIGNBYTES #define ALIGNBYTES 3. (diff)
downloadwireguard-openbsd-aea60bee5e9bad0aab62f480f19c2fb34c068de4.tar.xz
wireguard-openbsd-aea60bee5e9bad0aab62f480f19c2fb34c068de4.zip
Move to the <limits.h> universe.
review by millert, binary checking process with doug, concept with guenther
Diffstat (limited to 'lib/libc/net/getnetent.c')
-rw-r--r--lib/libc/net/getnetent.c12
1 files changed, 6 insertions, 6 deletions
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 <sys/param.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <netdb.h>
#include <stdio.h>
#include <string.h>
+#include <limits.h>
#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)