From 155e4e77aeffba57af04e504882d6ac24b22bbfc Mon Sep 17 00:00:00 2001 From: "alexis.lagoutte@gmail.com" Date: Mon, 27 Apr 2015 16:54:13 +0000 Subject: [PATCH] Fix Segmentation fault when ifa_addr is NULL FossilOrigin-Name: a8a048f9712810e9d9f3cacfe41b27a786b86e14db65998ccbc2416efbf9bcec --- src/capwap/sock_get_primary_if.c | 3 +++ src/capwap/sock_getifaddr.c | 3 +++ 2 files changed, 6 insertions(+) diff --git a/src/capwap/sock_get_primary_if.c b/src/capwap/sock_get_primary_if.c index d1a7229c..375e06f9 100644 --- a/src/capwap/sock_get_primary_if.c +++ b/src/capwap/sock_get_primary_if.c @@ -37,6 +37,9 @@ char * sock_get_primary_if(int family) continue; } + if (ifa->ifa_addr == NULL) + continue; + if (ifa->ifa_addr->sa_family != family) continue; diff --git a/src/capwap/sock_getifaddr.c b/src/capwap/sock_getifaddr.c index 07919cca..5942dbe9 100644 --- a/src/capwap/sock_getifaddr.c +++ b/src/capwap/sock_getifaddr.c @@ -37,6 +37,9 @@ int sock_getifaddr(const char * ifname,int family, int type,struct sockaddr * sa if (strcmp(ifname,ifa->ifa_name)) continue; + if (ifa->ifa_addr == NULL) + continue; + if (ifa->ifa_addr->sa_family != family) continue;