From mboxrd@z Thu Jan 1 00:00:00 1970 From: Wei Zhao Subject: [PATCH v2] app/testpmd: add boundary check in flow commandline Date: Thu, 6 Dec 2018 10:38:06 +0800 Message-ID: <1544063886-68323-1-git-send-email-wei.zhao1@intel.com> References: <1543902690-71857-1-git-send-email-wei.zhao1@intel.com> Cc: stable@dpdk.org, yuan.peng@intel.com, konstantin.ananyev@intel.com, Wei Zhao To: dev@dpdk.org Return-path: In-Reply-To: <1543902690-71857-1-git-send-email-wei.zhao1@intel.com> List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 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 --- 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