]> The Tcpdump Group git mirrors - tcpdump/blobdiff - print-ip6.c
Fail if nd_push_buffer() or nd_push_snaplen() fails.
[tcpdump] / print-ip6.c
index b3379baaeb7ced31cd3df9b6938b0a3a73ca64cb..829483345925c6d20c8b24ff789048aaa0b66873 100644 (file)
@@ -305,7 +305,10 @@ ip6_print(netdissect_options *ndo, const u_char *bp, u_int length)
        /*
         * Cut off the snapshot length to the end of the IP payload.
         */
-       nd_push_snapend(ndo, bp + len);
+       if (!nd_push_snaplen(ndo, bp, len)) {
+               (*ndo->ndo_error)(ndo, S_ERR_ND_MEM_ALLOC,
+                       "%s: can't push snaplen on buffer stack", __func__);
+       }
 
        cp = (const u_char *)ip6;
        advance = sizeof(struct ip6_hdr);
@@ -413,7 +416,7 @@ ip6_print(netdissect_options *ndo, const u_char *bp, u_int length)
                                if (length < len)
                                        ND_PRINT("truncated-ip6 - %u bytes missing!",
                                                len - length);
-                               nd_change_snapend(ndo, bp + len);
+                               nd_change_snaplen(ndo, bp, len);
 
                                /*
                                 * Now subtract the length of the IPv6
@@ -446,7 +449,7 @@ ip6_print(netdissect_options *ndo, const u_char *bp, u_int length)
                                         * accordingly.
                                         */
                                        len = sizeof(struct ip6_hdr);
-                                       nd_change_snapend(ndo, bp + len);
+                                       nd_change_snaplen(ndo, bp, len);
 
                                        /*
                                         * Now subtract the length of