summaryrefslogtreecommitdiffstats
path: root/sbin/ping/ping.c
diff options
context:
space:
mode:
authorderaadt <deraadt@openbsd.org>2015-01-16 06:39:28 +0000
committerderaadt <deraadt@openbsd.org>2015-01-16 06:39:28 +0000
commitb9fc9a728fce9c4289b7e9a992665e28d5629a54 (patch)
tree72b2433e418dfa1aef5fcf8305617b97979a25d8 /sbin/ping/ping.c
parentimprove checksum parsing slightly. now handles filenames with spaces. (diff)
downloadwireguard-openbsd-b9fc9a728fce9c4289b7e9a992665e28d5629a54.tar.xz
wireguard-openbsd-b9fc9a728fce9c4289b7e9a992665e28d5629a54.zip
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/ping.c')
-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) ||