You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

29 lines
1.1 KiB

From a8f5ed3ff337bce5222967fdf8c0b475fd28e74a Mon Sep 17 00:00:00 2001
From: John Light <john.j.light@intel.com>
Date: Thu, 30 Jul 2015 15:14:07 -0700
Subject: [PATCH] Avoid Segv by testing address field before using it.
sIssue reported off dev list by Gabriel Schulhof.
Change-Id: Ifa529da59fb784fd5cdef6ca333635cf99ed1f59
Signed-off-by: John Light <john.j.light@intel.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/2160
Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-by: Erich Keane <erich.keane@intel.com>
---
.../src/ip_adapter/linux/caipnwmonitor.c | 4 ++++
1 file changed, 4 insertions(+)
--- a/resource/csdk/connectivity/src/ip_adapter/linux/caipnwmonitor.c
+++ b/resource/csdk/connectivity/src/ip_adapter/linux/caipnwmonitor.c
@@ -57,6 +57,10 @@ u_arraylist_t *CAIPGetInterfaceInformati
struct ifaddrs *ifa = NULL;
for (ifa = ifp; ifa; ifa = ifa->ifa_next)
{
+ if (!ifa->ifa_addr)
+ {
+ continue;
+ }
int family = ifa->ifa_addr->sa_family;
if ((ifa->ifa_flags & IFF_LOOPBACK) || (AF_INET != family && AF_INET6 != family))
{