BUG/MINOR: dns: Fix check on nameserver in snr_resolution_cb

snr_resolution_cb can be called with <nameserver> parameter set to NULL. So we
must check it before using it. This is done most of time, except when we deal
with invalid DNS response.
This commit is contained in:
Christopher Faulet 2017-09-15 11:55:45 +02:00 committed by Willy Tarreau
parent ccbc3fd9f9
commit 3bbd65b23e
1 changed files with 4 additions and 3 deletions

View File

@ -3990,10 +3990,11 @@ int snr_resolution_cb(struct dns_requester *requester, struct dns_nameserver *na
return 1;
invalid:
if (nameserver)
if (nameserver) {
nameserver->counters.invalid += 1;
if (resolution->nb_responses >= nameserver->resolvers->count_nameservers)
goto update_status;
if (resolution->nb_responses >= nameserver->resolvers->count_nameservers)
goto update_status;
}
snr_update_srv_status(s, has_no_ip);
return 0;