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

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