From 561ae0a63516e092672532424904706f51eb2b84 Mon Sep 17 00:00:00 2001 From: Yoann Desmouceaux Date: Wed, 20 Sep 2017 10:08:28 +0200 Subject: CLI: fix segfault when browsing an empty history When one starts VPP, types a command, presses up rather than enter, then types a new command, unix_cli_line_process_one() segfaults. This is due to cf->cursor not being reset upon pressing up if the history is empty. Change-Id: Ie503f20a9cb551e735abb8b0f4feb8c0006d2b61 Signed-off-by: Yoann Desmouceaux --- src/vlib/unix/cli.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'src/vlib/unix/cli.c') diff --git a/src/vlib/unix/cli.c b/src/vlib/unix/cli.c index 1624ce387fb..0e035b1342b 100644 --- a/src/vlib/unix/cli.c +++ b/src/vlib/unix/cli.c @@ -1406,10 +1406,8 @@ unix_cli_line_process_one (unix_cli_main_t * cm, unix_vlib_cli_output_cooked (cf, uf, cf->current_command, vec_len (cf->current_command)); } - cf->cursor = vec_len (cf->current_command); - - break; } + cf->cursor = vec_len (cf->current_command); break; case UNIX_CLI_PARSE_ACTION_HOME: -- cgit 1.2.3-korg