]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
pinger: Fix buffer overflow in Icmp6::Recv
authorYuriy M. Kaminskiy <yumkam@gmail.com>
Wed, 30 Mar 2016 14:16:06 +0000 (03:16 +1300)
committerAmos Jeffries <squid3@treenet.co.nz>
Wed, 30 Mar 2016 14:16:06 +0000 (03:16 +1300)
src/icmp/Icmp6.cc

index 274bef6a6296a12f81d6a064291227ff2354730e..c583da11ef256d2f49d40534ae6ca5ad5fafa0fd 100644 (file)
@@ -277,7 +277,7 @@ Icmp6::Recv(void)
     #define ip6_hops   // HOPS!!!  (can it be true??)
 
         ip = (struct ip6_hdr *) pkt;
-        pkt += sizeof(ip6_hdr);
+        NP: echo size needs to +sizeof(ip6_hdr);
 
     debugs(42, DBG_CRITICAL, HERE << "ip6_nxt=" << ip->ip6_nxt <<
                ", ip6_plen=" << ip->ip6_plen <<
@@ -288,7 +288,6 @@ Icmp6::Recv(void)
     */
 
     icmp6header = (struct icmp6_hdr *) pkt;
-    pkt += sizeof(icmp6_hdr);
 
     if (icmp6header->icmp6_type != ICMP6_ECHO_REPLY) {
 
@@ -313,7 +312,7 @@ Icmp6::Recv(void)
         return;
     }
 
-    echo = (icmpEchoData *) pkt;
+    echo = (icmpEchoData *) (pkt + sizeof(icmp6_hdr));
 
     preply.opcode = echo->opcode;