summaryrefslogtreecommitdiffstats
path: root/freebsd/sbin/ping
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2013-10-30 11:56:00 +0100
committerSebastian Huber <sebastian.huber@embedded-brains.de>2013-10-31 13:18:53 +0100
commit58b493bb0c1a26ad84fc8ab4ed745453701d4a7f (patch)
treee8f08a281d521be3af07bd087a3b26800ed5f9cf /freebsd/sbin/ping
parentPING(8): Fix isxdigit() usage (diff)
downloadrtems-libbsd-58b493bb0c1a26ad84fc8ab4ed745453701d4a7f.tar.bz2
PING(8): Avoid large buffers on the stack
Diffstat (limited to 'freebsd/sbin/ping')
-rw-r--r--freebsd/sbin/ping/ping.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/freebsd/sbin/ping/ping.c b/freebsd/sbin/ping/ping.c
index 6ec8a5f2..4b7f96ad 100644
--- a/freebsd/sbin/ping/ping.c
+++ b/freebsd/sbin/ping/ping.c
@@ -263,7 +263,12 @@ main(argc, argv)
struct msghdr msg;
struct sigaction si_sa;
size_t sz;
+#ifndef __rtems__
u_char *datap, packet[IP_MAXPACKET] __aligned(4);
+#else /* __rtems__ */
+ u_char *datap;
+ static u_char packet[IP_MAXPACKET] __aligned(4);
+#endif /* __rtems__ */
char *ep, *source, *target, *payload;
struct hostent *hp;
#ifdef IPSEC_POLICY_IPSEC
@@ -275,7 +280,12 @@ main(argc, argv)
int almost_done, ch, df, hold, i, icmp_len, mib[4], preload, sockerrno,
tos, ttl;
char ctrl[CMSG_SPACE(sizeof(struct timeval))];
+#ifndef __rtems__
char hnamebuf[MAXHOSTNAMELEN], snamebuf[MAXHOSTNAMELEN];
+#else /* __rtems__ */
+ static char hnamebuf[MAXHOSTNAMELEN];
+ static char snamebuf[MAXHOSTNAMELEN];
+#endif /* __rtems__ */
#ifdef IP_OPTIONS
char rspace[MAX_IPOPTLEN]; /* record route space */
#endif