resolve: do not trigger assertions on invalid query
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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)) {
|
||||
|
||||
Reference in New Issue
Block a user