From ef1202d188ef97586c880e113843e19340a73642 Mon Sep 17 00:00:00 2001 From: Wei Zhao Date: Thu, 6 Dec 2018 10:38:06 +0800 Subject: [PATCH] app/testpmd: add boundary check in flow command There is need to add boundary for input number from commandline, If it beyond the definition, code will return error. Signed-off-by: Wei Zhao Reviewed-by: Ferruh Yigit --- app/test-pmd/cmdline_flow.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c index 5c0108fa70..659908fcf1 100644 --- a/app/test-pmd/cmdline_flow.c +++ b/app/test-pmd/cmdline_flow.c @@ -4327,6 +4327,8 @@ parse_int(struct context *ctx, const struct token *token, } buf = (uint8_t *)ctx->object + arg->offset; size = arg->size; + if (u > RTE_LEN2MASK(size * CHAR_BIT, uint64_t)) + return -1; objmask: switch (size) { case sizeof(uint8_t): -- 2.20.1