vlib: fix vector-as-C-string overflow 16/24016/2
authorBenoît Ganne <bganne@cisco.com>
Mon, 16 Dec 2019 14:49:47 +0000 (15:49 +0100)
committerDamjan Marion <dmarion@me.com>
Tue, 17 Dec 2019 18:01:57 +0000 (18:01 +0000)
Type: fix

Change-Id: If0419ff1a82d45e5b3326973008e1b9feb290c5a
Signed-off-by: Benoît Ganne <bganne@cisco.com>
src/vlib/cli.c
src/vlib/node_cli.c

index 6088fc2..467d1f7 100644 (file)
@@ -558,7 +558,7 @@ vlib_cli_dispatch_sub_commands (vlib_main_t * vm,
                    u32 c;
                  } *ed;
                  ed = ELOG_DATA (&vm->elog_main, e);
-                 ed->c = elog_string (&vm->elog_main, c->path);
+                 ed->c = elog_string (&vm->elog_main, "%v", c->path);
                }
 
              if (!c->is_mp_safe)
@@ -584,7 +584,7 @@ vlib_cli_dispatch_sub_commands (vlib_main_t * vm,
                    u32 c, err;
                  } *ed;
                  ed = ELOG_DATA (&vm->elog_main, e);
-                 ed->c = elog_string (&vm->elog_main, c->path);
+                 ed->c = elog_string (&vm->elog_main, "%v", c->path);
                  if (c_error)
                    {
                      vec_add1 (c_error->what, 0);
index 32c6c1a..bf18702 100644 (file)
@@ -606,7 +606,7 @@ show_node (vlib_main_t * vm, unformat_input_t * input,
   if (n->sibling_of)
     s = format (s, ", sibling-of %s", n->sibling_of);
 
-  vlib_cli_output (vm, "node %s, type %s, state %U, index %d%v\n",
+  vlib_cli_output (vm, "node %v, type %s, state %U, index %d%v\n",
                   n->name, type_str, format_vlib_node_state, vm, n,
                   n->index, s);
   vec_reset_length (s);