diff options
author | Rob Landley <rob@landley.net> | 2006-01-11 03:44:11 +0000 |
---|---|---|
committer | Rob Landley <rob@landley.net> | 2006-01-11 03:44:11 +0000 |
commit | bbf4e167f2caa248ba0eaa05b89d02b8d8f9e4ae (patch) | |
tree | 2166e57f03af9da0c739370a58de790b493a3b20 /networking/ping.c | |
parent | 009765d2caa1fd8abd29d9f782c5154c85591793 (diff) | |
download | busybox-w32-bbf4e167f2caa248ba0eaa05b89d02b8d8f9e4ae.tar.gz busybox-w32-bbf4e167f2caa248ba0eaa05b89d02b8d8f9e4ae.tar.bz2 busybox-w32-bbf4e167f2caa248ba0eaa05b89d02b8d8f9e4ae.zip |
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.
Diffstat (limited to 'networking/ping.c')
-rw-r--r-- | networking/ping.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/networking/ping.c b/networking/ping.c index 646f4ac37..ed52abf04 100644 --- a/networking/ping.c +++ b/networking/ping.c | |||
@@ -200,7 +200,7 @@ static void sendping(int junk) | |||
200 | { | 200 | { |
201 | struct icmp *pkt; | 201 | struct icmp *pkt; |
202 | int i; | 202 | int i; |
203 | char packet[datalen + 8]; | 203 | char packet[datalen + sizeof(struct icmp)]; |
204 | 204 | ||
205 | pkt = (struct icmp *) packet; | 205 | pkt = (struct icmp *) packet; |
206 | 206 | ||
@@ -211,7 +211,7 @@ static void sendping(int junk) | |||
211 | pkt->icmp_id = myid; | 211 | pkt->icmp_id = myid; |
212 | CLR(ntohs(pkt->icmp_seq) % MAX_DUP_CHK); | 212 | CLR(ntohs(pkt->icmp_seq) % MAX_DUP_CHK); |
213 | 213 | ||
214 | gettimeofday((struct timeval *) &packet[8], NULL); | 214 | gettimeofday((struct timeval *) &pkt->icmp_dun, NULL); |
215 | pkt->icmp_cksum = in_cksum((unsigned short *) pkt, sizeof(packet)); | 215 | pkt->icmp_cksum = in_cksum((unsigned short *) pkt, sizeof(packet)); |
216 | 216 | ||
217 | i = sendto(pingsock, packet, sizeof(packet), 0, | 217 | i = sendto(pingsock, packet, sizeof(packet), 0, |