1 --- a/networking/ping.c
2 +++ b/networking/ping.c
3 @@ -91,7 +91,7 @@ static void ping4(len_and_sockaddr *lsa)
4 struct sockaddr_in pingaddr;
7 - char packet[DEFDATALEN + MAXIPLEN + MAXICMPLEN];
8 + char packet[datalen + ICMP_MINLEN + MAXIPLEN + MAXICMPLEN];
10 pingsock = create_icmp_socket();
11 pingaddr = lsa->u.sin;
12 @@ -101,7 +101,7 @@ static void ping4(len_and_sockaddr *lsa)
13 pkt->icmp_type = ICMP_ECHO;
14 pkt->icmp_cksum = in_cksum((unsigned short *) pkt, sizeof(packet));
16 - c = xsendto(pingsock, packet, DEFDATALEN + ICMP_MINLEN,
17 + c = xsendto(pingsock, packet, datalen + ICMP_MINLEN,
18 (struct sockaddr *) &pingaddr, sizeof(pingaddr));
20 /* listen for replies */
21 @@ -135,7 +135,7 @@ static void ping6(len_and_sockaddr *lsa)
22 struct icmp6_hdr *pkt;
25 - char packet[DEFDATALEN + MAXIPLEN + MAXICMPLEN];
26 + char packet[datalen + ICMP_MINLEN + MAXIPLEN + MAXICMPLEN];
28 pingsock = create_icmp6_socket();
29 pingaddr = lsa->u.sin6;
30 @@ -147,7 +147,7 @@ static void ping6(len_and_sockaddr *lsa)
31 sockopt = offsetof(struct icmp6_hdr, icmp6_cksum);
32 setsockopt(pingsock, SOL_RAW, IPV6_CHECKSUM, &sockopt, sizeof(sockopt));
34 - c = xsendto(pingsock, packet, DEFDATALEN + sizeof (struct icmp6_hdr),
35 + c = xsendto(pingsock, packet, datalen + sizeof (struct icmp6_hdr),
36 (struct sockaddr *) &pingaddr, sizeof(pingaddr));
38 /* listen for replies */