[dpdk-dev] [PATCH v2] app/testpmd: add boundary check in flow commandline
Wei Zhao
wei.zhao1 at intel.com
Thu Dec 6 03:38:06 CET 2018
There is need to add boundary for input number from commandline,
If it beyond the defination, code will return error.
Signed-off-by: Wei Zhao <wei.zhao1 at intel.com>
---
v2:
change mask writing format.
---
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 23ea7cc..8b7a5c0 100644
--- a/app/test-pmd/cmdline_flow.c
+++ b/app/test-pmd/cmdline_flow.c
@@ -4325,6 +4325,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.7.5
More information about the dev
mailing list