]> git.ipfire.org Git - thirdparty/knot-resolver.git/commitdiff
lib/resolve: don't append EDNS to garbage packets
authorMarek Vavruša <mvavrusa@cloudflare.com>
Tue, 3 Apr 2018 21:04:32 +0000 (14:04 -0700)
committerMarek Vavruša <mvavrusa@cloudflare.com>
Fri, 7 Sep 2018 17:45:21 +0000 (10:45 -0700)
The current handler will try to construct the compression table
starting with query name in question. If there's no query name,
it's going to construct it with garbage bytes.

lib/resolve.c

index d18a9284a4b1d64a1bd82606f2d24cbbcd51e4b3..af1f317f23efed102fc64a4ca462b8b83606cd0d 100644 (file)
@@ -383,7 +383,8 @@ static int ns_resolve_addr(struct kr_query *qry, struct kr_request *param)
 
 static int edns_put(knot_pkt_t *pkt)
 {
-       if (!pkt->opt_rr) {
+       /* Don't append EDNS to garbage packets */
+       if (!pkt->opt_rr || knot_pkt_qname(pkt) == NULL) {
                return kr_ok();
        }
        /* Reclaim reserved size. */