]> git.ipfire.org Git - thirdparty/strongswan.git/commitdiff
kernel-pfroute: Make sure there is a netmask when enumerating subnets
authorTobias Brunner <tobias@strongswan.org>
Tue, 20 Jun 2017 10:16:56 +0000 (12:16 +0200)
committerTobias Brunner <tobias@strongswan.org>
Wed, 5 Jul 2017 08:21:25 +0000 (10:21 +0200)
src/libcharon/plugins/kernel_pfroute/kernel_pfroute_net.c

index 6d06ee1797f4b000b1949357afa2a2df01470dee..da7ae472dedfe1648fcb765e2b0510959f23cdf4 100644 (file)
@@ -1831,7 +1831,7 @@ METHOD(enumerator_t, enumerate_subnets, bool,
        for (; this->current < this->buf + this->len;
                 this->current += rtm->rtm_msglen)
        {
-               struct sockaddr *netmask;
+               struct sockaddr *netmask = NULL;
                uint8_t netbits = 0;
 
                rtm = (struct rt_msghdr*)this->current;
@@ -1864,7 +1864,7 @@ METHOD(enumerator_t, enumerate_subnets, bool,
                                this->ifname = strndup(sdl->sdl_data, sdl->sdl_nlen);
                        }
                }
-               if (this->net)
+               if (this->net && netmask)
                {
                        netbits = sockaddr_to_netmask(netmask, this->net);
                }