diff options
author | Ulrich Drepper <drepper@gmail.com> | 2010-10-11 09:38:00 -0400 |
---|---|---|
committer | Andreas Schwab <schwab@redhat.com> | 2010-12-01 15:35:13 +0100 |
commit | a0ad547936d671e7dffe53fb119f9066c351a30a (patch) | |
tree | 292c8f02f427e038df4b109315ec9369ae3c4562 | |
parent | 2a6164985436568518d000943785b010de317280 (diff) | |
download | glibc-a0ad547936d671e7dffe53fb119f9066c351a30a.zip glibc-a0ad547936d671e7dffe53fb119f9066c351a30a.tar.gz glibc-a0ad547936d671e7dffe53fb119f9066c351a30a.tar.bz2 |
Linux getifaddrs might return entries with ->ifa_addr being NULL.
(cherry picked from commit 1751705d1c4e8b7aba391391d1d8d88fe8c9d8b8)
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/check_pf.c | 13 |
2 files changed, 14 insertions, 5 deletions
@@ -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] diff --git a/sysdeps/unix/sysv/linux/check_pf.c b/sysdeps/unix/sysv/linux/check_pf.c index e694342..b789a32 100644 --- a/sysdeps/unix/sysv/linux/check_pf.c +++ b/sysdeps/unix/sysv/linux/check_pf.c @@ -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 |