summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2020-11-10 14:52:25 +0100
committerLennart Poettering <lennart@poettering.net>2021-02-14 23:05:38 +0100
commit894c7b77081e8eba8d78722624cc145f87ae95ac (patch)
treef84b47ed6012fa14b223047c77035f58f441537d /src
parentresolved: gracefully handle with packets with too large RR count (diff)
downloadsystemd-894c7b77081e8eba8d78722624cc145f87ae95ac.tar.xz
systemd-894c7b77081e8eba8d78722624cc145f87ae95ac.zip
resolved: gracefully handle trailing packet garbage
Similar to the previous commit: if we see trailing garbage in a DNS packet, let's assume EDNS is borked too, and suppress it.
Diffstat (limited to 'src')
-rw-r--r--src/resolve/resolved-dns-packet.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/resolve/resolved-dns-packet.c b/src/resolve/resolved-dns-packet.c
index 953d5fa337..f548bbf9f2 100644
--- a/src/resolve/resolved-dns-packet.c
+++ b/src/resolve/resolved-dns-packet.c
@@ -2394,6 +2394,12 @@ int dns_packet_extract(DnsPacket *p) {
if (r < 0)
return r;
+ if (p->rindex < p->size) {
+ log_debug("Trailing garbage in packet, suppressing OPT.");
+ p->opt = dns_resource_record_unref(p->opt);
+ p->opt_start = p->opt_size = SIZE_MAX;
+ }
+
p->question = TAKE_PTR(question);
p->answer = TAKE_PTR(answer);