]> git.ipfire.org Git - thirdparty/knot-resolver.git/commitdiff
iterate.c: fail on execissive data in a packet
authorŠtěpán Balážik <stepan.balazik@nic.cz>
Wed, 20 Jan 2021 11:25:38 +0000 (12:25 +0100)
committerŠtěpán Balážik <stepan.balazik@nic.cz>
Fri, 5 Feb 2021 09:46:15 +0000 (10:46 +0100)
lib/layer/iterate.c

index 94342cfb510eccdf09d31ef3b76c09c33ea34512..09944d02753aa1ef609cebb8b44077e3ecc6cce2 100644 (file)
@@ -1013,13 +1013,10 @@ static int resolve(kr_layer_t *ctx, knot_pkt_t *pkt)
        /* Check for packet processing errors first.
         * Note - we *MUST* check if it has at least a QUESTION,
         * otherwise it would crash on accessing QNAME. */
-#ifdef STRICT_MODE
        if (pkt->parsed < pkt->size) {
                VERBOSE_MSG("<= pkt contains excessive data\n");
                return KR_STATE_FAIL;
-       } else
-#endif
-       if (pkt->parsed <= KNOT_WIRE_HEADER_SIZE) {
+       } else if (pkt->parsed <= KNOT_WIRE_HEADER_SIZE) {
                if (pkt->parsed == KNOT_WIRE_HEADER_SIZE && knot_wire_get_rcode(pkt->wire) == KNOT_RCODE_FORMERR) {
                        /* This is a special case where we get valid header with FORMERR and nothing else.
                         * This happens on some authoritatives which don't support EDNS and don't