hopefully fix ping bugs introduced in [6443]
SVN-Revision: 6505
This commit is contained in:
parent
eb83bc789a
commit
07cb246bd7
1 changed files with 1 additions and 12 deletions
|
@ -5,7 +5,7 @@
|
||||||
struct icmp *pkt;
|
struct icmp *pkt;
|
||||||
int pingsock, c;
|
int pingsock, c;
|
||||||
- char packet[DEFDATALEN + MAXIPLEN + MAXICMPLEN];
|
- char packet[DEFDATALEN + MAXIPLEN + MAXICMPLEN];
|
||||||
+ char packet[datalen + MAXIPLEN + MAXICMPLEN];
|
+ char packet[datalen + ICMP_MINLEN + MAXIPLEN + MAXICMPLEN];
|
||||||
|
|
||||||
pingsock = create_icmp_socket();
|
pingsock = create_icmp_socket();
|
||||||
|
|
||||||
|
@ -18,17 +18,6 @@
|
||||||
(struct sockaddr *) &pingaddr, sizeof(struct sockaddr_in));
|
(struct sockaddr *) &pingaddr, sizeof(struct sockaddr_in));
|
||||||
|
|
||||||
if (c < 0) {
|
if (c < 0) {
|
||||||
@@ -257,8 +257,8 @@
|
|
||||||
|
|
||||||
gettimeofday(&tv, NULL);
|
|
||||||
|
|
||||||
- /* discard if too short */
|
|
||||||
- if (sz < (datalen + ICMP_MINLEN))
|
|
||||||
+ /* discard if too short / long */
|
|
||||||
+ if (sz < (datalen + ICMP_MINLEN) || sz > (MAXICMPLEN))
|
|
||||||
return;
|
|
||||||
|
|
||||||
/* check IP header */
|
|
||||||
@@ -274,6 +274,10 @@
|
@@ -274,6 +274,10 @@
|
||||||
++nreceived;
|
++nreceived;
|
||||||
tp = (struct timeval *) icmppkt->icmp_data;
|
tp = (struct timeval *) icmppkt->icmp_data;
|
||||||
|
|
Loading…
Reference in a new issue