*  IPv4 version ignoring IP header in size
*  Ping replys from 8.8.8.8 have limited size, so pinging it with large packets 
(more than 89 bytes in payload) caused false ping fails
​​​​​​​To reproduce:
«ping -s 88» will succeed
«ping -s 89» will fails
 
diff --git a/networking/ping.c b/networking/ping.c
index b7e6955a9..ecf9c569e 100644
--- a/networking/ping.c
+++ b/networking/ping.c
@@ -696,7 +696,7 @@ static int unpack4(char *buf, int sz, struct sockaddr_in 
*from)
     int hlen;
 
     /* discard if too short */
-    if (sz < (datalen + ICMP_MINLEN))
+    if (sz < (sizeof(struct iphdr) + ICMP_MINLEN))
         return 0;
 
     /* check IP header */
@@ -732,7 +732,7 @@ static int unpack6(char *packet, int sz, struct 
sockaddr_in6 *from, int hoplimit
     char buf[INET6_ADDRSTRLEN];
 
     /* discard if too short */
-    if (sz < (datalen + sizeof(struct icmp6_hdr)))
+    if (sz < sizeof(struct icmp6_hdr))
         return 0;
 
     icmppkt = (struct icmp6_hdr *) packet;
 
--
Миша Завёрткин
Отправлено из Почты  Mail.ru
_______________________________________________
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox

Reply via email to