]> 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 13:47:57 +0000 (02:47 +1300)
committerAmos Jeffries <squid3@treenet.co.nz>
Wed, 30 Mar 2016 13:47:57 +0000 (02:47 +1300)
src/icmp/Icmp6.cc

index f9b374f6c3486a7e81bf470a86898145a1ed6f16..654838bee945819e73cc6e434c76239df96cd132 100644 (file)
@@ -256,7 +256,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 <<
@@ -267,7 +267,6 @@ Icmp6::Recv(void)
     */
 
     icmp6header = (struct icmp6_hdr *) pkt;
-    pkt += sizeof(icmp6_hdr);
 
     if (icmp6header->icmp6_type != ICMP6_ECHO_REPLY) {
 
@@ -292,7 +291,7 @@ Icmp6::Recv(void)
         return;
     }
 
-    echo = (icmpEchoData *) pkt;
+    echo = (icmpEchoData *) (pkt + sizeof(icmp6_hdr));
 
     preply.opcode = echo->opcode;