You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by cc...@apache.org on 2016/11/23 18:52:29 UTC

[66/70] [abbrv] incubator-mynewt-core git commit: mn_socket - Allow for itfs with null address flds.

mn_socket - Allow for itfs with null address flds.

On my home machine, my "ppp0" pp2p interface triggered this bug.  From
`man getifaddrs`:

    The  ifa_addr  field  points  to  a  structure containing the
    interface address. [...] This  field may contain a null pointer.


Project: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/commit/eab4949b
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/eab4949b
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/eab4949b

Branch: refs/heads/master
Commit: eab4949b208821419b00cdd5cf6e7b0bc8aae05b
Parents: 94ac3d6
Author: Christopher Collins <cc...@apache.org>
Authored: Tue Nov 22 17:33:44 2016 -0800
Committer: Christopher Collins <cc...@apache.org>
Committed: Tue Nov 22 17:33:44 2016 -0800

----------------------------------------------------------------------
 net/ip/native_sockets/src/native_itf.c | 3 +++
 1 file changed, 3 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/eab4949b/net/ip/native_sockets/src/native_itf.c
----------------------------------------------------------------------
diff --git a/net/ip/native_sockets/src/native_itf.c b/net/ip/native_sockets/src/native_itf.c
index eb60154..6c186ca 100644
--- a/net/ip/native_sockets/src/native_itf.c
+++ b/net/ip/native_sockets/src/native_itf.c
@@ -166,6 +166,9 @@ native_sock_itf_addr_getnext(struct mn_itf *mi, struct mn_itf_addr *mia)
         if (if_nametoindex(ifa->ifa_name) != mi->mif_idx) {
             continue;
         }
+        if (ifa->ifa_addr == NULL) {
+            continue;
+        }
         if (ifa->ifa_addr->sa_family == AF_INET) {
             sin = (struct sockaddr_in *)ifa->ifa_addr;
             if (addrcmp(MN_AF_INET, &sin->sin_addr,