summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNathan Skrzypczak <nathan.skrzypczak@gmail.com>2020-11-23 17:56:32 +0100
committerDave Barach <openvpp@barachs.net>2020-11-23 19:08:09 +0000
commit19ce5022250da13f253443aa6900c2d1965db0ce (patch)
treed8ac6a87f6463651f03d3d3f302838826638ae2c
parent2cdb301678b3ba26331a9bc63ca1ab7af131e281 (diff)
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 <nathan.skrzypczak@gmail.com>
-rw-r--r--src/vlib/cli.c5
1 files changed, 5 insertions, 0 deletions
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');