From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by dpdk.org (Postfix) with ESMTP id 58B736C9B; Thu, 6 Dec 2018 04:02:59 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 05 Dec 2018 19:02:58 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.56,320,1539673200"; d="scan'208";a="105229070" Received: from dpdk6.bj.intel.com ([172.16.182.192]) by fmsmga007.fm.intel.com with ESMTP; 05 Dec 2018 19:02:54 -0800 From: Wei Zhao To: dev@dpdk.org Cc: stable@dpdk.org, yuan.peng@intel.com, konstantin.ananyev@intel.com, Wei Zhao Date: Thu, 6 Dec 2018 10:38:06 +0800 Message-Id: <1544063886-68323-1-git-send-email-wei.zhao1@intel.com> X-Mailer: git-send-email 2.7.5 In-Reply-To: <1543902690-71857-1-git-send-email-wei.zhao1@intel.com> References: <1543902690-71857-1-git-send-email-wei.zhao1@intel.com> Subject: [dpdk-dev] [PATCH v2] app/testpmd: add boundary check in flow commandline X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 Dec 2018 03:03:01 -0000 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