54798860fc8dc4aff6031a5583f626ccff2d0df7
[openwrt.git] / package / busybox / patches / 460-truncated_ping_results.patch
1 Index: busybox-1.7.2/networking/ping.c
2 ===================================================================
3 --- busybox-1.7.2.orig/networking/ping.c        2007-10-30 15:34:59.000000000 -0500
4 +++ busybox-1.7.2/networking/ping.c     2007-10-30 15:35:05.000000000 -0500
5 @@ -91,7 +91,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         pingaddr = lsa->sin;
14 @@ -101,7 +101,7 @@
15         pkt->icmp_type = ICMP_ECHO;
16         pkt->icmp_cksum = in_cksum((unsigned short *) pkt, sizeof(packet));
17  
18 -       c = xsendto(pingsock, packet, DEFDATALEN + ICMP_MINLEN,
19 +       c = xsendto(pingsock, packet, datalen + ICMP_MINLEN,
20                            (struct sockaddr *) &pingaddr, sizeof(pingaddr));
21  
22         /* listen for replies */
23 @@ -135,7 +135,7 @@
24         struct icmp6_hdr *pkt;
25         int pingsock, c;
26         int sockopt;
27 -       char packet[DEFDATALEN + MAXIPLEN + MAXICMPLEN];
28 +       char packet[datalen + ICMP_MINLEN + MAXIPLEN + MAXICMPLEN];
29  
30         pingsock = create_icmp6_socket();
31         pingaddr = lsa->sin6;
32 @@ -147,7 +147,7 @@
33         sockopt = offsetof(struct icmp6_hdr, icmp6_cksum);
34         setsockopt(pingsock, SOL_RAW, IPV6_CHECKSUM, &sockopt, sizeof(sockopt));
35  
36 -       c = xsendto(pingsock, packet, DEFDATALEN + sizeof (struct icmp6_hdr),
37 +       c = xsendto(pingsock, packet, datalen + sizeof (struct icmp6_hdr),
38                            (struct sockaddr *) &pingaddr, sizeof(pingaddr));
39  
40         /* listen for replies */