summaryrefslogtreecommitdiff
path: root/sbin/ping
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2015-01-16 06:40:24 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2015-01-16 06:40:24 +0000
commit315054f4737a39489e0a14f3a92bff61f1592832 (patch)
tree62bf010653374ce09b6beb4dfa0414a91457233b /sbin/ping
parent79e3d817585ca08a91e30ad14abe43e2ab70295f (diff)
Replace <sys/param.h> with <limits.h> and other less dirty headers where
possible. Annotate <sys/param.h> lines with their current reasons. Switch to PATH_MAX, NGROUPS_MAX, HOST_NAME_MAX+1, LOGIN_NAME_MAX, etc. Change MIN() and MAX() to local definitions of MINIMUM() and MAXIMUM() where sensible to avoid pulling in the pollution. These are the files confirmed through binary verification. ok guenther, millert, doug (helped with the verification protocol)
Diffstat (limited to 'sbin/ping')
-rw-r--r--sbin/ping/ping.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/sbin/ping/ping.c b/sbin/ping/ping.c
index f9d37c14af5..46750461d79 100644
--- a/sbin/ping/ping.c
+++ b/sbin/ping/ping.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ping.c,v 1.113 2014/11/20 15:22:39 tedu Exp $ */
+/* $OpenBSD: ping.c,v 1.114 2015/01/16 06:40:00 deraadt Exp $ */
/* $NetBSD: ping.c,v 1.20 1995/08/11 22:37:58 cgd Exp $ */
/*
@@ -70,6 +70,7 @@
#include <errno.h>
#include <poll.h>
#include <string.h>
+#include <limits.h>
#include <stdlib.h>
struct tv32 {
@@ -179,7 +180,7 @@ main(int argc, char *argv[])
struct in_addr saddr;
int ch, i, optval = 1, packlen, preload, maxsize, df = 0, tos = 0;
u_char *datap, *packet, ttl = MAXTTL, loop = 1;
- char *target, hnamebuf[MAXHOSTNAMELEN];
+ char *target, hnamebuf[HOST_NAME_MAX+1];
char rspace[3 + 4 * NROUTES + 1]; /* record route space */
socklen_t maxsizelen;
const char *errstr;
@@ -1207,7 +1208,7 @@ pr_addr(in_addr_t a)
{
struct hostent *hp;
struct in_addr in;
- static char buf[16+3+MAXHOSTNAMELEN];
+ static char buf[16+3+HOST_NAME_MAX+1];
in.s_addr = a;
if ((options & F_NUMERIC) ||