diff options
author | Rajendra Dendukuri <rajendra.dendukuri@broadcom.com> | 2019-06-12 23:53:01 -0400 |
---|---|---|
committer | Rajendra Dendukuri <rajendra.dendukuri@broadcom.com> | 2019-06-13 19:42:37 -0700 |
commit | b5bf04316373de3909615ea692027117618662a0 (patch) | |
tree | 058b6b67eacbbff9d123d20fdf13c55edfff03de | |
parent | 0441ead2f5a4d3c5cb524cb2503ea157328f3dc6 (diff) | |
download | netifaces-git-b5bf04316373de3909615ea692027117618662a0.tar.gz |
segfault when trying to access netifaces.ifaddresses
Signed-off-by: Rajendra Dendukuri <rajendra.dendukuri@broadcom.com>
-rw-r--r-- | netifaces.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/netifaces.c b/netifaces.c index fa18add..c73d14b 100644 --- a/netifaces.c +++ b/netifaces.c @@ -1024,7 +1024,7 @@ ifaddrs (PyObject *self, PyObject *args) char buffer[256]; PyObject *pyaddr = NULL, *netmask = NULL, *braddr = NULL, *flags = NULL; - if (strcmp (addr->ifa_name, ifname) != 0) + if (addr->ifa_name == NULL || strcmp (addr->ifa_name, ifname) != 0) continue; /* We mark the interface as found, even if there are no addresses; @@ -1357,6 +1357,9 @@ interfaces (PyObject *self) } for (addr = addrs; addr; addr = addr->ifa_next) { + if (addr->ifa_name == NULL) + continue; + if (!prev_name || strncmp (addr->ifa_name, prev_name, IFNAMSIZ) != 0) { PyObject *ifname = PyUnicode_FromString (addr->ifa_name); |