]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
Linux getifaddrs might return entries with ->ifa_addr being NULL.
authorUlrich Drepper <drepper@gmail.com>
Mon, 11 Oct 2010 13:38:00 +0000 (09:38 -0400)
committerAndreas Schwab <schwab@redhat.com>
Wed, 1 Dec 2010 14:35:13 +0000 (15:35 +0100)
(cherry picked from commit 1751705d1c4e8b7aba391391d1d8d88fe8c9d8b8)

ChangeLog
sysdeps/unix/sysv/linux/check_pf.c

index 8037d6361d93e232ffd9999daa15ccd026caa105..0d020c83e685d8c5f97a7bd9b8af923d1731d374 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2010-10-11  Ulrich Drepper  <drepper@gmail.com>
+
+       [BZ #12093]
+       * sysdeps/unix/sysv/linux/check_pf.c (__check_pf): ->ifa_addr might
+       be NULL.
+
 2010-10-03  Ulrich Drepper  <drepper@gmail.com>
 
        [BZ #12005]
index e694342998460d9715936a7a04d6d6533e9ef246..b789a32eab65acda77794e736e4d3a6e6e58c8fc 100644 (file)
@@ -1,5 +1,5 @@
 /* Determine protocol families for which interfaces exist.  Linux version.
-   Copyright (C) 2003, 2006, 2007, 2008 Free Software Foundation, Inc.
+   Copyright (C) 2003, 2006, 2007, 2008, 2010 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -304,10 +304,13 @@ __check_pf (bool *seen_ipv4, bool *seen_ipv6,
 
   struct ifaddrs *runp;
   for (runp = ifa; runp != NULL; runp = runp->ifa_next)
-    if (runp->ifa_addr->sa_family == PF_INET)
-      *seen_ipv4 = true;
-    else if (runp->ifa_addr->sa_family == PF_INET6)
-      *seen_ipv6 = true;
+    if (runp->ifa_addr != NULL)
+      {
+       if (runp->ifa_addr->sa_family == PF_INET)
+         *seen_ipv4 = true;
+       else if (runp->ifa_addr->sa_family == PF_INET6)
+         *seen_ipv6 = true;
+      }
 
   (void) freeifaddrs (ifa);
 #endif