From 3bbd65b23eba214abf07d5728fe74909fc5d286d Mon Sep 17 00:00:00 2001 From: Christopher Faulet Date: Fri, 15 Sep 2017 11:55:45 +0200 Subject: [PATCH] BUG/MINOR: dns: Fix check on nameserver in snr_resolution_cb snr_resolution_cb can be called with 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. --- src/server.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/server.c b/src/server.c index ec2dbe8943..ebfe0e5c02 100644 --- a/src/server.c +++ b/src/server.c @@ -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;