resolve: do not trigger assertions on invalid query

This commit is contained in:
Yu Watanabe
2022-07-09 05:20:10 +09:00
parent f2605af1f2
commit 055acd4d8b
2 changed files with 5 additions and 2 deletions
+3 -1
View File
@@ -1011,7 +1011,9 @@ void dns_scope_process_query(DnsScope *s, DnsStream *stream, DnsPacket *p) {
return;
}
assert(dns_question_size(p->question) == 1);
if (dns_question_size(p->question) != 1)
return (void) log_debug("Received LLMNR query without question or multiple questions, ignoring.");
key = dns_question_first_key(p->question);
r = dns_zone_lookup(&s->zone, key, 0, &answer, &soa, &tentative);
+2 -1
View File
@@ -254,7 +254,8 @@ static int mdns_scope_process_query(DnsScope *s, DnsPacket *p) {
if (r < 0)
return log_debug_errno(r, "Failed to extract resource records from incoming packet: %m");
assert_return((dns_question_size(p->question) > 0), -EINVAL);
if (dns_question_size(p->question) <= 0)
return log_debug_errno(SYNTHETIC_ERRNO(EBADMSG), "Received mDNS query without question, ignoring.");
unicast_reply = mdns_should_reply_using_unicast(p);
if (unicast_reply && !sender_on_local_subnet(s, p)) {