prevent madwifi from building on UML
[openwrt.git] / package / busybox / patches / 450-truncated_ping_results.patch
1 Index: busybox-1.4.2/networking/ping.c
2 ===================================================================
3 --- busybox-1.4.2.orig/networking/ping.c 2007-06-04 13:21:31.931122400 +0200
4 +++ busybox-1.4.2/networking/ping.c 2007-06-04 13:21:36.518425024 +0200
5 @@ -70,7 +70,7 @@
6 struct sockaddr_in pingaddr;
7 struct icmp *pkt;
8 int pingsock, c;
9 - char packet[DEFDATALEN + MAXIPLEN + MAXICMPLEN];
10 + char packet[datalen + ICMP_MINLEN + MAXIPLEN + MAXICMPLEN];
11
12 pingsock = create_icmp_socket();
13
14 @@ -86,7 +86,7 @@
15 pkt->icmp_type = ICMP_ECHO;
16 pkt->icmp_cksum = in_cksum((unsigned short *) pkt, sizeof(packet));
17
18 - c = sendto(pingsock, packet, DEFDATALEN + ICMP_MINLEN, 0,
19 + c = sendto(pingsock, packet, datalen + ICMP_MINLEN, 0,
20 (struct sockaddr *) &pingaddr, sizeof(struct sockaddr_in));
21
22 if (c < 0) {
23 @@ -274,6 +274,10 @@
24 ++nreceived;
25 tp = (struct timeval *) icmppkt->icmp_data;
26
27 + /* If packet is too short, results will be truncated */
28 + if (sz < (ICMP_MINLEN + sizeof(tv.tv_sec) + sizeof(tv.tv_usec)))
29 + return;
30 +
31 if ((tv.tv_usec -= tp->tv_usec) < 0) {
32 --tv.tv_sec;
33 tv.tv_usec += 1000000;
This page took 0.047329 seconds and 5 git commands to generate.