diff options
author | Vladimír Čunát <vladimir.cunat@nic.cz> | 2017-01-23 15:00:18 +0100 |
---|---|---|
committer | Vladimír Čunát <vladimir.cunat@nic.cz> | 2017-01-23 15:00:18 +0100 |
commit | 2f78b1f12e88b72e0bc2a2554a822c4409e3dd19 (patch) | |
tree | bcfecf7abb2caccdad67cfdbfc658aaa75d8fc7c /lib/layer/iterate.c | |
parent | Merge !165: improve fallback on bad replies (diff) | |
parent | Perform the excessive size (junk at the end of the packet) only in strict_mode (diff) | |
download | knot-resolver-2f78b1f12e88b72e0bc2a2554a822c4409e3dd19.tar.xz knot-resolver-2f78b1f12e88b72e0bc2a2554a822c4409e3dd19.zip |
Merge !166: accept packets with junk after end (by default)
Closes #133.
Diffstat (limited to '')
-rw-r--r-- | lib/layer/iterate.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/layer/iterate.c b/lib/layer/iterate.c index ea3fca56..25f3a616 100644 --- a/lib/layer/iterate.c +++ b/lib/layer/iterate.c @@ -758,7 +758,13 @@ 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. */ - if (pkt->parsed < pkt->size || pkt->parsed <= KNOT_WIRE_HEADER_SIZE) { +#ifdef STRICT_MODE + if (pkt->parsed < pkt->size) { + VERBOSE_MSG("<= pkt contains excessive data\n"); + return resolve_badmsg(pkt, req, query); + } else +#endif + if (pkt->parsed <= KNOT_WIRE_HEADER_SIZE) { VERBOSE_MSG("<= malformed response\n"); return resolve_badmsg(pkt, req, query); } else if (!is_paired_to_query(pkt, query)) { |