svn commit: trunk/busybox/networking

vda at busybox.net vda at busybox.net
Tue Apr 29 12:31:53 UTC 2008


Author: vda
Date: 2008-04-29 05:31:53 -0700 (Tue, 29 Apr 2008)
New Revision: 21893

Log:
ping: dont leak uninitialized data in ping packets

function                                             old     new   delta
sendping4                                            176     186     +10
sendping6                                             93     100      +7



Modified:
   trunk/busybox/networking/ping.c


Changeset:
Modified: trunk/busybox/networking/ping.c
===================================================================
--- trunk/busybox/networking/ping.c	2008-04-29 06:53:55 UTC (rev 21892)
+++ trunk/busybox/networking/ping.c	2008-04-29 12:31:53 UTC (rev 21893)
@@ -372,9 +372,10 @@
 	 * *after* packet. Saves one if() */
 	struct icmp *pkt = alloca(datalen + ICMP_MINLEN + 4);
 
+	memset(pkt, 0, datalen + ICMP_MINLEN + 4);
 	pkt->icmp_type = ICMP_ECHO;
-	pkt->icmp_code = 0;
-	pkt->icmp_cksum = 0;
+	/*pkt->icmp_code = 0;*/
+	/*pkt->icmp_cksum = 0;*/
 	pkt->icmp_seq = htons(ntransmitted); /* don't ++ here, it can be a macro */
 	pkt->icmp_id = myid;
 
@@ -391,9 +392,10 @@
 {
 	struct icmp6_hdr *pkt = alloca(datalen + sizeof(struct icmp6_hdr) + 4);
 
+	memset(pkt, 0, datalen + sizeof(struct icmp6_hdr) + 4);
 	pkt->icmp6_type = ICMP6_ECHO_REQUEST;
-	pkt->icmp6_code = 0;
-	pkt->icmp6_cksum = 0;
+	/*pkt->icmp6_code = 0;*/
+	/*pkt->icmp6_cksum = 0;*/
 	pkt->icmp6_seq = htons(ntransmitted); /* don't ++ here, it can be a macro */
 	pkt->icmp6_id = myid;
 




More information about the busybox-cvs mailing list