]> git.ipfire.org Git - thirdparty/ldns.git/commitdiff
add assert in ldns_pkt_edns_get_option_list()
authorTCY16 <tom@nlnetlabs.nl>
Mon, 25 Apr 2022 08:07:39 +0000 (10:07 +0200)
committerTCY16 <tom@nlnetlabs.nl>
Mon, 25 Apr 2022 08:07:39 +0000 (10:07 +0200)
packet.c

index b39b0e10191e7542f3bf54107ecfee362a93b753..0c16fd537f177f871fdd7cfe1854bbfa946a1f04 100644 (file)
--- a/packet.c
+++ b/packet.c
@@ -769,8 +769,9 @@ ldns_pkt_edns_get_option_list(const ldns_pkt *packet)
        size_t max;
        const uint8_t* wire;
 
-       if (!ldns_pkt_edns_data(packet))
+       if (!ldns_pkt_edns_data(packet)) {
                return NULL;
+       }
 
        /* return the list if it already exists */
        if (packet->_edns_list != NULL) {
@@ -779,9 +780,9 @@ ldns_pkt_edns_get_option_list(const ldns_pkt *packet)
 
        /* if the list doesn't exists, we create it by parsing the _edns_data */
 
+       assert(ldns_pkt_edns_data(packet));
        max = ldns_rdf_size(ldns_pkt_edns_data(packet));
        wire = ldns_rdf_data(ldns_pkt_edns_data(packet));
-       // @TODO do checks so we don't read into un-auth memory (max !< 4)
 
        edns_list = ldns_edns_option_list_new();
        if (edns_list == NULL) {