diff options
-rw-r--r-- | networking/ping.c | 4 | ||||
-rw-r--r-- | networking/ping6.c | 4 |
2 files changed, 4 insertions, 4 deletions
diff --git a/networking/ping.c b/networking/ping.c index d33cb358f..7fe52ab39 100644 --- a/networking/ping.c +++ b/networking/ping.c | |||
@@ -108,7 +108,7 @@ static void ping(const char *host) | |||
108 | pkt->icmp_type = ICMP_ECHO; | 108 | pkt->icmp_type = ICMP_ECHO; |
109 | pkt->icmp_cksum = in_cksum((unsigned short *) pkt, sizeof(packet)); | 109 | pkt->icmp_cksum = in_cksum((unsigned short *) pkt, sizeof(packet)); |
110 | 110 | ||
111 | c = sendto(pingsock, packet, sizeof(packet), 0, | 111 | c = sendto(pingsock, packet, DEFDATALEN + ICMP_MINLEN, 0, |
112 | (struct sockaddr *) &pingaddr, sizeof(struct sockaddr_in)); | 112 | (struct sockaddr *) &pingaddr, sizeof(struct sockaddr_in)); |
113 | 113 | ||
114 | if (c < 0 || c != sizeof(packet)) | 114 | if (c < 0 || c != sizeof(packet)) |
@@ -202,7 +202,7 @@ static void sendping(int junk) | |||
202 | { | 202 | { |
203 | struct icmp *pkt; | 203 | struct icmp *pkt; |
204 | int i; | 204 | int i; |
205 | char packet[datalen + sizeof(struct icmp)]; | 205 | char packet[datalen + ICMP_MINLEN]; |
206 | 206 | ||
207 | pkt = (struct icmp *) packet; | 207 | pkt = (struct icmp *) packet; |
208 | 208 | ||
diff --git a/networking/ping6.c b/networking/ping6.c index 4e55081fb..3f632e060 100644 --- a/networking/ping6.c +++ b/networking/ping6.c | |||
@@ -111,7 +111,7 @@ static void ping(const char *host) | |||
111 | setsockopt(pingsock, SOL_RAW, IPV6_CHECKSUM, (char *) &sockopt, | 111 | setsockopt(pingsock, SOL_RAW, IPV6_CHECKSUM, (char *) &sockopt, |
112 | sizeof(sockopt)); | 112 | sizeof(sockopt)); |
113 | 113 | ||
114 | c = sendto(pingsock, packet, sizeof(packet), 0, | 114 | c = sendto(pingsock, packet, DEFDATALEN + sizeof (struct icmp6_hdr), 0, |
115 | (struct sockaddr *) &pingaddr, sizeof(struct sockaddr_in6)); | 115 | (struct sockaddr *) &pingaddr, sizeof(struct sockaddr_in6)); |
116 | 116 | ||
117 | if (c < 0 || c != sizeof(packet)) | 117 | if (c < 0 || c != sizeof(packet)) |
@@ -204,7 +204,7 @@ static void sendping(int junk) | |||
204 | { | 204 | { |
205 | struct icmp6_hdr *pkt; | 205 | struct icmp6_hdr *pkt; |
206 | int i; | 206 | int i; |
207 | char packet[datalen + 8]; | 207 | char packet[datalen + sizeof (struct icmp6_hdr)]; |
208 | 208 | ||
209 | pkt = (struct icmp6_hdr *) packet; | 209 | pkt = (struct icmp6_hdr *) packet; |
210 | 210 | ||