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.
This commit is contained in:
Lennart Poettering
2021-02-14 23:05:38 +01:00
parent 18674159eb
commit 894c7b7708
+6
View File
@@ -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);