From 30220d1e35a92bbf3e6694d81b308630c7db27c3 Mon Sep 17 00:00:00 2001 From: kevinshen Date: Thu, 7 Jul 2022 12:10:03 +0800 Subject: [PATCH] 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 --- lib/resolver.c | 3 +++ 1 file changed, 3 insertions(+) mode change 100644 => 100755 lib/resolver.c diff --git a/lib/resolver.c b/lib/resolver.c old mode 100644 new mode 100755 index 93fa84bbe9..0d64ad86e4 --- a/lib/resolver.c +++ b/lib/resolver.c @@ -245,6 +245,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, -- 2.39.5