]> granicus.if.org Git - libtirpc/commitdiff
libtirpc: fix crash with tuntap devices libtirpc-0-2-6-rc2
authorOlaf Kirch <okir@suse.de>
Tue, 16 Dec 2014 19:02:39 +0000 (14:02 -0500)
committerSteve Dickson <steved@redhat.com>
Tue, 16 Dec 2014 19:04:34 +0000 (14:04 -0500)
Linux tuntap devices and other virtual network devices, if not
configured, will be reported by getifaddrs() with a NULL ifa_addr
pointer. __rpc_getifaddrs would trip over that, because it derefenced
the ifa_addr pointer without checking.

Signed-off-by: Olaf Kirch <okir@suse.de>
Signed-off-by: Steve Dickson <steved@redhat.com>
src/clnt_bcast.c

index 1ae637ddcb437cb5606b7bb064b607a08c114ca5..ddcb6945d4c36dbf288f67c029453d2b9ac2c76e 100644 (file)
@@ -142,7 +142,8 @@ __rpc_getbroadifs(int af, int proto, int socktype, broadlist_t *list)
                return 0;
 
        for (ifap = ifp; ifap != NULL; ifap = ifap->ifa_next) {
-               if (ifap->ifa_addr->sa_family != af ||
+               if (ifap->ifa_addr == NULL ||           /* happens for eg tuntap devices */
+                   ifap->ifa_addr->sa_family != af ||
                    !(ifap->ifa_flags & IFF_UP))
                        continue;
                bip = (struct broadif *)malloc(sizeof *bip);