|
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))
|
|
{
|