aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Kotov <kot@yandex.ru>2017-07-10 18:23:31 +0300
committerChris Luke <chris_luke@comcast.com>2017-07-10 17:04:35 +0000
commite6fa2e3d5abf37fbebd5c7f5951271d519003b41 (patch)
tree6f1a25d7c765c7567ae8fb9c0e7eac14510981bf
parent24a97d6c27bba4c0cd65625c627e5df51fdf9809 (diff)
VPP-904: fixes zero length CLI parameters parse
Change-Id: I21fbc9aff2b97a8b3f4cbed202c00b6d84557a6e Signed-off-by: Alexander Kotov <kot@yandex.ru> (cherry picked from commit 28160f38488743b8cee0a7bd62b432a9dd8f4bfd)
-rw-r--r--src/vppinfra/unformat.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/vppinfra/unformat.c b/src/vppinfra/unformat.c
index f626f05e355..5b17562f359 100644
--- a/src/vppinfra/unformat.c
+++ b/src/vppinfra/unformat.c
@@ -401,7 +401,7 @@ unformat_line (unformat_input_t * i, va_list * va)
}
*result = line;
- return 1;
+ return vec_len (line);
}
/* Parse a line ending with \n and return it as an unformat_input_t. */
@@ -410,7 +410,8 @@ unformat_line_input (unformat_input_t * i, va_list * va)
{
unformat_input_t *result = va_arg (*va, unformat_input_t *);
u8 *line;
- unformat_user (i, unformat_line, &line);
+ if (!unformat_user (i, unformat_line, &line))
+ return 0;
unformat_init_vector (result, line);
return 1;
}