From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 06793A0C55; Wed, 13 Oct 2021 20:46:08 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id ED917411FA; Wed, 13 Oct 2021 20:45:45 +0200 (CEST) Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2071.outbound.protection.outlook.com [40.107.94.71]) by mails.dpdk.org (Postfix) with ESMTP id 914DA4121D; Wed, 13 Oct 2021 20:45:44 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=PoPdYjHGJ8S2XqwLq/GCLjGRDhqyIMrHc/1Rs32kwZFnfy87jUPyB9X5BnGECGCQWA6p9Wf8eANzFbJtNr6kWhhZiyB/+ha3b/mETu7qRBmCxqCZC45VE1Ljy06OZiOl2Maq2QOYPhy58vv4zKQzsLJ5fadEtVY9plKQVNxsS9ROP34VBDdEbLYfbDES5ldjPAMbuBvXj/zpVTDV4Bx0Ysvh06FwhYGL5mlD4NedrO2zjFnvotquPktipOSMxoWR751rtHQY7BB384FxlEtEZEMmq/wo+lOrtkKKb+w2rDRHoB8D5kD1xaY6hIc93nMTFDIj+OaGm6Tx4epkeOiUdw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=TJ3ma+w+SZM3lSH36wTvF3MwpDEU6LoJpX8Xc8eQXg8=; b=ZsPT6HHHOyubwERmQhr2n5cor95omuYn2/A1RPY+G3Gjh47yPzP8L4fVp5nbXJv+/nt0+NYuaeEmJwC2B1YjoVDm2BKPJMQ0Tz3eNQh7ufgo8UKpW4JPooM2guzK79dNctaevyxOqyIV9XKQuEdV5Mi1xE7T/+EiQ4g/ZMDIsRH0ZdUKPYCpWuRinkhprQrijL+kGYA5RSB38uPjitTi2gMHUiuA/QGnMUubM2Ct7ZBHl0Ck75sH0BkcDD6M4tkWPxJ35jOqphO9p8IbRORHe1AEwWZXK5a1KAmKPL3M+g7baiVv3QGN7Ll6kyCxjOBCiIciaFOhsFJOAYWzTzFTmQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.112.34) smtp.rcpttodomain=dpdk.org smtp.mailfrom=nvidia.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=TJ3ma+w+SZM3lSH36wTvF3MwpDEU6LoJpX8Xc8eQXg8=; b=tL5YINyGkFMnNK7rCZTkpD4a5sBz8RpK4KFoHp0iW6JLQF14VAUdgVmN3JQCm7bqx1VxJw2zOENxrRysi9RUdsFfcDjoPJetxU+S64dgd5V+plmp+Q8dF3Mwq7UWvpgqqLd1NRdCBrT92VnckZlbxN0Z0kO+nDWL+CQO36kHdQGu2et4seN0WTD93eVqjnlmtrZMScN/Q15o2H2rD1nnbYrqhfGUE9GjqUbFBXU1igz/F5SaUtBM1m/b5zotMJ7NJA5sOxp3BKxC+PvT5DPbl8F5UX7bmq+TsOTJM6efzMuYBzBG7jsBQgOz82AkW47nW8l4fG9XmsqRhDk1QDkbQw== Received: from MWHPR14CA0050.namprd14.prod.outlook.com (2603:10b6:300:81::12) by BL0PR12MB5540.namprd12.prod.outlook.com (2603:10b6:208:1cb::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4608.15; Wed, 13 Oct 2021 18:45:43 +0000 Received: from CO1NAM11FT016.eop-nam11.prod.protection.outlook.com (2603:10b6:300:81:cafe::dc) by MWHPR14CA0050.outlook.office365.com (2603:10b6:300:81::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4608.15 via Frontend Transport; Wed, 13 Oct 2021 18:45:42 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.112.34) smtp.mailfrom=nvidia.com; dpdk.org; dkim=none (message not signed) header.d=none;dpdk.org; dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.112.34 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.112.34; helo=mail.nvidia.com; Received: from mail.nvidia.com (216.228.112.34) by CO1NAM11FT016.mail.protection.outlook.com (10.13.175.141) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4608.15 via Frontend Transport; Wed, 13 Oct 2021 18:45:42 +0000 Received: from nvidia.com (172.20.187.5) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Wed, 13 Oct 2021 18:45:40 +0000 From: Viacheslav Ovsiienko To: CC: , , , , , , Date: Wed, 13 Oct 2021 21:45:15 +0300 Message-ID: <20211013184516.25338-5-viacheslavo@nvidia.com> X-Mailer: git-send-email 2.18.1 In-Reply-To: <20211013184516.25338-1-viacheslavo@nvidia.com> References: <20210910141609.8410-1-viacheslavo@nvidia.com> <20211013184516.25338-1-viacheslavo@nvidia.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [172.20.187.5] X-ClientProxiedBy: HQMAIL101.nvidia.com (172.20.187.10) To HQMAIL107.nvidia.com (172.20.187.13) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 73ed2ac9-b97f-45b7-ab08-08d98e79a8df X-MS-TrafficTypeDiagnostic: BL0PR12MB5540: X-LD-Processed: 43083d15-7273-40c1-b7db-39efd9ccc17a,ExtAddr X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:2803; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: zEkZaJJBG2+Ui/9voSpzArhMdBQIsnksIiLfBRB+gIUn+SF+F35wDh5rjsAlz9CD/wEGOPOich2qymnZ2q2E9rEUSeyQq6HYqxDLKda0aGnawjHp14ds7e80He7Bt888XzI+WN+2X0NIBAp7FL2CGCJA4f6UQVfD2Q6N0JEf4FRwfU68N2oUHdk3npHutbqmne8akc7ZZa+OyLW43Ef4qN9OCpRWqTFQZnbGuiVyfyPmG3g7tkPnTUe9Ulx/nGJJpRYEO0AqPmuiV98lgtsseIgfoEsDh4LoNBf178lO3bZBB7mozTCwRKtMpO6BVTsacnTgkc0fnJuuL8LHoavppon5IXQ+5HZCCh0dwHfQgzAi9tyMAp5XTrD+fBhglMAWwor+gRcg95/IDWNVwFHMzal7wThfXE6KqK52TPpCQSHueMSXGXRdl8r8ESjZWp8CsnEkE9QR75JzWScz3znTcKpzg6x6vu2iXNCrCAxl0r2bVDf7l9b9rPWStrVOmMX74sUi4uJN82hVPx/sA3jdNNmZcy3EEXwbzWWX64kwNw5jCdnfo/eiVS5zL7Q8818XCzHeq+r7eRFAQ8554rMaSlwnoTjjT5bT5aVtta1KHi6PCkOnP9tDC+KzetG9kCHHTz6HGi194DULLGUkweqkfvF6v5b/ixgOSIy/Lr8UqtWiMoG8kFiXM9OBJYteyqsAo2IhtrG3Ld8tvcpu+0snNw== X-Forefront-Antispam-Report: CIP:216.228.112.34; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:schybrid03.nvidia.com; CAT:NONE; SFS:(4636009)(46966006)(36840700001)(336012)(55016002)(83380400001)(70206006)(36756003)(8676002)(1076003)(36906005)(316002)(82310400003)(36860700001)(5660300002)(4326008)(47076005)(6916009)(2616005)(2906002)(26005)(16526019)(86362001)(6666004)(54906003)(8936002)(70586007)(7696005)(186003)(426003)(508600001)(7636003)(6286002)(356005); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Oct 2021 18:45:42.3940 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 73ed2ac9-b97f-45b7-ab08-08d98e79a8df X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.112.34]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: CO1NAM11FT016.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL0PR12MB5540 Subject: [dpdk-dev] [PATCH v6 4/5] app/testpmd: fix hex string parser in flow commands X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" The hexadecimal string parser does not check the target field buffer size, buffer overflow happens and might cause the application failure (segmentation fault is observed usually). Fixes: 169a9fed1f4c ("app/testpmd: fix hex string parser support for flow API") Cc: stable@dpdk.org Signed-off-by: Viacheslav Ovsiienko Acked-by: Ori Kam --- app/test-pmd/cmdline_flow.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c index 736029c4fd..6827d9228f 100644 --- a/app/test-pmd/cmdline_flow.c +++ b/app/test-pmd/cmdline_flow.c @@ -7291,10 +7291,13 @@ parse_hex(struct context *ctx, const struct token *token, hexlen -= 2; } if (hexlen > length) - return -1; + goto error; ret = parse_hex_string(str, hex_tmp, &hexlen); if (ret < 0) goto error; + /* Check the converted binary fits into data buffer. */ + if (hexlen > size) + goto error; /* Let parse_int() fill length information first. */ ret = snprintf(tmp, sizeof(tmp), "%u", hexlen); if (ret < 0) -- 2.18.1