summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRob Landley2006-01-11 03:44:11 +0000
committerRob Landley2006-01-11 03:44:11 +0000
commitbbf4e167f2caa248ba0eaa05b89d02b8d8f9e4ae (patch)
tree2166e57f03af9da0c739370a58de790b493a3b20
parent009765d2caa1fd8abd29d9f782c5154c85591793 (diff)
downloadbusybox-bbf4e167f2caa248ba0eaa05b89d02b8d8f9e4ae.zip
busybox-bbf4e167f2caa248ba0eaa05b89d02b8d8f9e4ae.tar.gz
Ok, ping needs a rewrite from the ground up. (This is not a busybox app.)
Fix bug 309, where ping -s 1 localhost would give an elapsed time 9 digits long due to a stack overflow. Apparently, iputils also does this.
-rw-r--r--networking/ping.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/networking/ping.c b/networking/ping.c
index 646f4ac..ed52abf 100644
--- a/networking/ping.c
+++ b/networking/ping.c
@@ -200,7 +200,7 @@ static void sendping(int junk)
{
struct icmp *pkt;
int i;
- char packet[datalen + 8];
+ char packet[datalen + sizeof(struct icmp)];
pkt = (struct icmp *) packet;
@@ -211,7 +211,7 @@ static void sendping(int junk)
pkt->icmp_id = myid;
CLR(ntohs(pkt->icmp_seq) % MAX_DUP_CHK);
- gettimeofday((struct timeval *) &packet[8], NULL);
+ gettimeofday((struct timeval *) &pkt->icmp_dun, NULL);
pkt->icmp_cksum = in_cksum((unsigned short *) pkt, sizeof(packet));
i = sendto(pingsock, packet, sizeof(packet), 0,