]> git.ipfire.org Git - thirdparty/bird.git/commitdiff
Nest: Fix recursive route update
authorOndrej Zajicek (work) <santiago@crfreenet.org>
Thu, 10 Oct 2019 12:01:16 +0000 (14:01 +0200)
committerOndrej Zajicek (work) <santiago@crfreenet.org>
Thu, 10 Oct 2019 12:01:16 +0000 (14:01 +0200)
Missing cleanup can lead to dangling pointer to old next hops.

nest/rt-table.c

index b55bcd40d9b5cd6a383106d6d09d5d03c380d353..97a5d1bc798ced372ac1ff06c32a93319a75c8ce 100644 (file)
@@ -2109,9 +2109,10 @@ no_nexthop:
     else
     {
       nhr = nhp;
-      nhp = (nhp ? (nhp->next = lp_allocz(rte_update_pool, NEXTHOP_MAX_SIZE)) : &(a->nh));
+      nhp = (nhp ? (nhp->next = lp_alloc(rte_update_pool, NEXTHOP_MAX_SIZE)) : &(a->nh));
     }
 
+    memset(nhp, 0, NEXTHOP_MAX_SIZE);
     nhp->iface = nh->iface;
     nhp->weight = nh->weight;
     if (mls)