mdns: Fix potential null deref reported by fuzzer test

This commit is contained in:
David Cermak 2021-12-07 16:17:53 +01:00 committed by bot
parent 8d5316ceb8
commit 03f9eedc27

View File

@ -2484,7 +2484,8 @@ static bool _mdns_question_matches(mdns_parsed_question_t * question, uint16_t t
if (type == MDNS_TYPE_A || type == MDNS_TYPE_AAAA) { if (type == MDNS_TYPE_A || type == MDNS_TYPE_AAAA) {
return true; return true;
} else if (type == MDNS_TYPE_PTR || type == MDNS_TYPE_SDPTR) { } else if (type == MDNS_TYPE_PTR || type == MDNS_TYPE_SDPTR) {
if (!strcasecmp(service->service->service, question->service) if (question->service && question->proto && question->domain
&& !strcasecmp(service->service->service, question->service)
&& !strcasecmp(service->service->proto, question->proto) && !strcasecmp(service->service->proto, question->proto)
&& !strcasecmp(MDNS_DEFAULT_DOMAIN, question->domain)) { && !strcasecmp(MDNS_DEFAULT_DOMAIN, question->domain)) {
return true; return true;