]> git.puffer.fish Git - matthieu/frr.git/commitdiff
lib: check hostname in resolver_resolve
authorkevinshen <kevinshen@inspur.com>
Thu, 7 Jul 2022 04:10:03 +0000 (12:10 +0800)
committerMergify <37929162+mergify[bot]@users.noreply.github.com>
Thu, 7 Jul 2022 07:10:38 +0000 (07:10 +0000)
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 <kevinshen@inspur.com>
(cherry picked from commit 30220d1e35a92bbf3e6694d81b308630c7db27c3)

lib/resolver.c [changed mode: 0644->0755]

old mode 100644 (file)
new mode 100755 (executable)
index 29138bb..b32e10d
@@ -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,