svn commit: trunk/busybox/networking

landley at busybox.net landley at busybox.net
Sat Apr 1 17:28:13 UTC 2006


Author: landley
Date: 2006-04-01 09:28:11 -0800 (Sat, 01 Apr 2006)
New Revision: 14722

Log:
Patch from KRONSTORFER Horst to Fix a size mismatch in ping, such as the 56/84
mismatch inthe following example:
  # ping -c 1 172.16.2.1
  PING 172.16.2.1 (172.16.2.1): 56 data bytes
  84 bytes from 172.16.2.1: icmp_seq=0 ttl=64 time=0.2 ms


Modified:
   trunk/busybox/networking/ping.c
   trunk/busybox/networking/ping6.c


Changeset:
Modified: trunk/busybox/networking/ping.c
===================================================================
--- trunk/busybox/networking/ping.c	2006-04-01 03:23:03 UTC (rev 14721)
+++ trunk/busybox/networking/ping.c	2006-04-01 17:28:11 UTC (rev 14722)
@@ -108,7 +108,7 @@
 	pkt->icmp_type = ICMP_ECHO;
 	pkt->icmp_cksum = in_cksum((unsigned short *) pkt, sizeof(packet));
 
-	c = sendto(pingsock, packet, sizeof(packet), 0,
+	c = sendto(pingsock, packet, DEFDATALEN + ICMP_MINLEN, 0,
 			   (struct sockaddr *) &pingaddr, sizeof(struct sockaddr_in));
 
 	if (c < 0 || c != sizeof(packet))
@@ -202,7 +202,7 @@
 {
 	struct icmp *pkt;
 	int i;
-	char packet[datalen + sizeof(struct icmp)];
+	char packet[datalen + ICMP_MINLEN];
 
 	pkt = (struct icmp *) packet;
 

Modified: trunk/busybox/networking/ping6.c
===================================================================
--- trunk/busybox/networking/ping6.c	2006-04-01 03:23:03 UTC (rev 14721)
+++ trunk/busybox/networking/ping6.c	2006-04-01 17:28:11 UTC (rev 14722)
@@ -111,7 +111,7 @@
 	setsockopt(pingsock, SOL_RAW, IPV6_CHECKSUM, (char *) &sockopt,
 			   sizeof(sockopt));
 
-	c = sendto(pingsock, packet, sizeof(packet), 0,
+	c = sendto(pingsock, packet, DEFDATALEN + sizeof (struct icmp6_hdr), 0,
 			   (struct sockaddr *) &pingaddr, sizeof(struct sockaddr_in6));
 
 	if (c < 0 || c != sizeof(packet))
@@ -204,7 +204,7 @@
 {
 	struct icmp6_hdr *pkt;
 	int i;
-	char packet[datalen + 8];
+	char packet[datalen + sizeof (struct icmp6_hdr)];
 
 	pkt = (struct icmp6_hdr *) packet;
 




More information about the busybox-cvs mailing list