From 19ce5022250da13f253443aa6900c2d1965db0ce Mon Sep 17 00:00:00 2001 From: Nathan Skrzypczak Date: Mon, 23 Nov 2020 17:56:32 +0100 Subject: vlib: Fix sh int addr format_l2_input might return s=0 which causes vlib_cli_output to print weird things when calling sh int addr Type: fix Change-Id: I3fe747979355e41aed51656f3b44e0eb76d33ef9 Signed-off-by: Nathan Skrzypczak --- src/vlib/cli.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/vlib/cli.c') diff --git a/src/vlib/cli.c b/src/vlib/cli.c index a88bd3a62f6..68f16fc33f0 100644 --- a/src/vlib/cli.c +++ b/src/vlib/cli.c @@ -703,6 +703,11 @@ vlib_cli_output (vlib_main_t * vm, char *fmt, ...) s = va_format (0, fmt, &va); va_end (va); + /* some format functions might return 0 + * e.g. show int addr */ + if (NULL == s) + return; + /* Terminate with \n if not present. */ if (vec_len (s) > 0 && s[vec_len (s) - 1] != '\n') vec_add1 (s, '\n'); -- cgit 1.2.3-korg