Skip to content

Commit

Permalink
Linux getifaddrs might return entries with ->ifa_addr being NULL.
Browse files Browse the repository at this point in the history
  • Loading branch information
Ulrich Drepper committed Oct 11, 2010
1 parent 9ff8d36 commit 1751705
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 6 deletions.
6 changes: 6 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -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-07 Jakub Jelinek <jakub@redhat.com>

[BZ #3268]
Expand Down
2 changes: 1 addition & 1 deletion NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Version 2.13
* The following bugs are resolved with this release:

3268, 7066, 10851, 11611, 11640, 11701, 11840, 11856, 11883, 11903, 11904,
11968, 11979, 12005, 12037, 12067, 12077, 12092, 12107
11968, 11979, 12005, 12037, 12067, 12077, 12092, 12093, 12107

* New Linux interfaces: prlimit, prlimit64, fanotify_init, fanotify_mark

Expand Down
13 changes: 8 additions & 5 deletions sysdeps/unix/sysv/linux/check_pf.c
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 1751705

Please sign in to comment.