FIB: pass a copy the walk context 16/17716/2
authorNeale Ranns <nranns@cisco.com>
Thu, 14 Feb 2019 14:58:40 +0000 (14:58 +0000)
committerNeale Ranns <nranns@cisco.com>
Wed, 13 Mar 2019 12:26:36 +0000 (12:26 +0000)
since it can realloc when new ctx are added. If
not we can get some nasty memory corruption.

Change-Id: I617709c3013acbcb8aee07dc147894f0de896555
Signed-off-by: Neale Ranns <nranns@cisco.com>
(cherry picked from commit 58085f2f6757e464196b283cc8335ab5cf34a012)

src/vnet/fib/fib_walk.c

index d094240..3fe586e 100644 (file)
@@ -350,7 +350,9 @@ fib_walk_advance (fib_node_index_t fwi)
 
         while (ii < n_ctxs)
         {
-           wrc = fib_node_back_walk_one(&sibling, &fwalk->fw_ctx[ii]);
+            fib_node_back_walk_ctx_t ctx = fwalk->fw_ctx[ii];
+
+           wrc = fib_node_back_walk_one(&sibling, &ctx);
 
             ii++;
            fwalk = fib_walk_get(fwi);