From bfbe976586fda9305eccfc1b65834c204ce64599 Mon Sep 17 00:00:00 2001 From: Siarhei Volkau Date: Fri, 3 Jan 2025 15:56:05 +0200 Subject: [PATCH] common: ofi_ifname_toaddr check ifa->ifa_addr for null ifa->ifa_addr might be NULL, thus led to crash. Signed-off-by: Siarhei Volkau --- src/common.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/common.c b/src/common.c index 0d641ac74a1..91e4dbc5213 100644 --- a/src/common.c +++ b/src/common.c @@ -847,8 +847,9 @@ static int ofi_ifname_toaddr(const char *name, uint32_t *addr_format, return ret; for (ifa = ifaddrs; ifa; ifa = ifa->ifa_next) { - if (ifa->ifa_addr->sa_family != AF_INET && - ifa->ifa_addr->sa_family != AF_INET6) + if (ifa->ifa_addr == NULL || + (ifa->ifa_addr->sa_family != AF_INET && + ifa->ifa_addr->sa_family != AF_INET6)) continue; if (!strcmp(name, ifa->ifa_name)) break;