]> The Tcpdump Group git mirrors - tcpdump/blobdiff - print-ospf6.c
Remove libpcap-layer issues from tests/pktap-heap-overflow.pcap.
[tcpdump] / print-ospf6.c
index e8a9dc6d547daab7ad9326ae52a4c76b6740467c..66ab2f75ff046ec273e8d3faca5daffc9ed9940d 100644 (file)
@@ -389,8 +389,7 @@ ospf6_print_lshdr(netdissect_options *ndo,
 {
        if ((const u_char *)(lshp + 1) > dataend)
                goto trunc;
-       ND_TCHECK(lshp->ls_type);
-       ND_TCHECK(lshp->ls_seq);
+       ND_TCHECK(lshp->ls_length);     /* last field of struct lsa6_hdr */
 
        ND_PRINT((ndo, "\n\t  Advertising Router %s, seq 0x%08x, age %us, length %u",
                ipaddr_string(ndo, &lshp->ls_router),
@@ -648,6 +647,7 @@ ospf6_print_lsa(netdissect_options *ndo,
                if (lsa_length < sizeof (llsap->llsa_lladdr) + sizeof (llsap->llsa_nprefix))
                        return (1);
                lsa_length -= sizeof (llsap->llsa_lladdr) + sizeof (llsap->llsa_nprefix);
+                ND_TCHECK(llsap->llsa_nprefix);
                 prefixes = EXTRACT_32BITS(&llsap->llsa_nprefix);
                ND_PRINT((ndo, "\n\t      Priority %d, Link-local address %s, Prefixes %d:",
                        llsap->llsa_priority,
@@ -735,6 +735,7 @@ ospf6_decode_v3(netdissect_options *ndo,
        case OSPF_TYPE_HELLO: {
                register const struct hello6 *hellop = (const struct hello6 *)((const uint8_t *)op + OSPF6HDR_LEN);
 
+               ND_TCHECK_32BITS(&hellop->hello_options);
                ND_PRINT((ndo, "\n\tOptions [%s]",
                          bittok2str(ospf6_option_values, "none",
                          EXTRACT_32BITS(&hellop->hello_options))));
@@ -933,10 +934,12 @@ ospf6_decode_v3_trailer(netdissect_options *ndo,
 
        if (op->ospf6_type == OSPF_TYPE_HELLO) {
                const struct hello6 *hellop = (const struct hello6 *)((const uint8_t *)op + OSPF6HDR_LEN);
+               ND_TCHECK(hellop->hello_options);
                if (EXTRACT_32BITS(&hellop->hello_options) & OSPF6_OPTION_L)
                        lls_hello = 1;
        } else if (op->ospf6_type == OSPF_TYPE_DD) {
                const struct dd6 *ddp = (const struct dd6 *)((const uint8_t *)op + OSPF6HDR_LEN);
+               ND_TCHECK(ddp->db_options);
                if (EXTRACT_32BITS(&ddp->db_options) & OSPF6_OPTION_L)
                        lls_dd = 1;
        }