From: kevinshen Date: Thu, 7 Jul 2022 04:10:03 +0000 (+0800) Subject: lib: check hostname in resolver_resolve X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=c6040d98b35f31b79864d8ab40493ef6f8273685;p=matthieu%2Ffrr.git lib: check hostname in resolver_resolve resolver_resolve should check hostname is null or not. if ares_gethostbyname() get null hostname string, the hostname string will access a null pointer and crash. Signed-off-by: kevinshen (cherry picked from commit 30220d1e35a92bbf3e6694d81b308630c7db27c3) --- diff --git a/lib/resolver.c b/lib/resolver.c old mode 100644 new mode 100755 index 29138bbc8d..b32e10d91d --- a/lib/resolver.c +++ b/lib/resolver.c @@ -252,6 +252,9 @@ void resolver_resolve(struct resolver_query *query, int af, vrf_id_t vrf_id, { int ret; + if (hostname == NULL) + return; + if (query->callback != NULL) { flog_err( EC_LIB_RESOLVER,