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 897D5A0C43; Mon, 11 Oct 2021 01:46:44 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 7B28841102; Mon, 11 Oct 2021 01:46:28 +0200 (CEST) Received: from NAM02-BN1-obe.outbound.protection.outlook.com (mail-bn1nam07on2079.outbound.protection.outlook.com [40.107.212.79]) by mails.dpdk.org (Postfix) with ESMTP id 1C7E2410F4; Mon, 11 Oct 2021 01:46:27 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=H/eCDZS4k2VSlqwS9swOdewaFNQvETJHdMQr69NrqS1lAjkmuT/E+f+/4U16K+lUywb3KkyaaGv8R0zoBu6WG5l3NsG4zlI4UI0tVwWWJpA9+d8hzW0ixYmwjcvFm70Xsw7lF0VO40PhXhUUDD7WMsLaJbmqHG6thGxsapPGU6wWh4VdYXDgRIApuopr2gPvVnks0A+sjMJhSF9kDZrxiy+t0a9SFNsv/VrnBBdr4SGkr/sggbqF1vb1wi4pDer5Ec8vJRFo+3wObK0nrHvl+FQt1v1ipvqAU5z4aVl/O/Gx27V6GYRFLDZVZQdfQkpx3NvitCKvh8Ssr3Z1EeWtvA== 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=M4wHDtZDjG6Ie4BGB5/xbzPQBkcMMEKySVzzMHYQBMk=; b=Ymz6ZoNLJHF409tuFiAc0vYh4FocQSiJ24FIvWRdHsfQZszzW75LytgxYja+kBIOFf9YFfyZRNY4FkkGNLJ3vqWC9t4IxeO2TbJ/MbNMZscI3AgY5cmfx7F8jXSahLBi6qlFji6d6w/cY/7jTKfz6xDIS+L1FQLR/7gfL4jC0OPHKGdWRomjVDEIzLPMJGqvT4sxPpu6xHVxw47fFvgMhevl+FWDU5NViT0wmQAjldcWBWirFOOwUINrJ9gbAl2FYl73oQPLGUVuV1a3PlysA3L+sibc8Tl2hrn5JHq4WVxESXHFYz2MTJJ0VCxuhoBsqoRFlf60CfKfu1eRa3/sjw== 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=none 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=M4wHDtZDjG6Ie4BGB5/xbzPQBkcMMEKySVzzMHYQBMk=; b=SW/FjaL3owmSqHcymapbswxrpacc32iDXcXusknr/78VtdVJt/89C85wLPehNp8UCMGU/g8uITrGbtvAmDclpNzTFnLA5mBt1i44k2oAOSL8kCXct+Uo1kXXee3qv24DbeTbXiJY11719AbH8T9jwJddQvocf4uRHqGFiWaCY8rRfSjls+R9bSA0BxlaqrrjC9XIPkSb7lIQtiWPUOSj0OY+Tzrkvo5I5kZlrSqzc/FxXIBHzpXNkssnsJPc6idxlmVwES3OnN8wjx3HWi5McJf37px0RcTsYaQ3JDJUdHQAK552fnSViPnAoc61rhtJkAi2QMyhQYZGolHyFB3HWw== Received: from DM5PR15CA0070.namprd15.prod.outlook.com (2603:10b6:3:ae::32) by BYAPR12MB3415.namprd12.prod.outlook.com (2603:10b6:a03:d5::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4587.25; Sun, 10 Oct 2021 23:46:21 +0000 Received: from DM6NAM11FT057.eop-nam11.prod.protection.outlook.com (2603:10b6:3:ae:cafe::86) by DM5PR15CA0070.outlook.office365.com (2603:10b6:3:ae::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4587.18 via Frontend Transport; Sun, 10 Oct 2021 23:46:21 +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 DM6NAM11FT057.mail.protection.outlook.com (10.13.172.252) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4587.18 via Frontend Transport; Sun, 10 Oct 2021 23:46:20 +0000 Received: from nvidia.com (172.20.187.6) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Sun, 10 Oct 2021 23:46:18 +0000 From: Viacheslav Ovsiienko To: CC: , , , , , , Date: Mon, 11 Oct 2021 02:45:45 +0300 Message-ID: <20211010234547.1495-4-viacheslavo@nvidia.com> X-Mailer: git-send-email 2.18.1 In-Reply-To: <20211010234547.1495-1-viacheslavo@nvidia.com> References: <20210910141609.8410-1-viacheslavo@nvidia.com> <20211010234547.1495-1-viacheslavo@nvidia.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [172.20.187.6] 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: e47050fb-097b-4789-3715-08d98c48295f X-MS-TrafficTypeDiagnostic: BYAPR12MB3415: 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: YpDzOvGoxXgwPIdl59eNwplnLYBbKtVEEMzKBkhomkI7MIpQgW10WZ68tpNmQKyeu3D88seYQyxc5jWn3spTKFZPno1Oh5GcJ0q81RIX5cmMFOJKwGDmmgmxqTo+UganpYiDDZYE1HimZq10/0s0HVySbiKtXFQNtQ3SXQZSnGZiJGmy+g4/KizBqc2q8kQVNMFFu1R0VH1tpmn37MVEMbVmQL+HVeFQGMLmxvbW583d9sIMpa9lbz3jiZh6al00RvkLro61jQAcd3Aga9Oy1oLw4M4hWgcL51Z5xNb8JhCMHMISoC9TPWBq4PDQDlRk2u1E0234e5u2vtyy/v4JNciOQAXGEtdSLm0JzbYWVAuMHYS1dxATMPU3WBAyBgruWi3fiPJwFfKp7tT0E66ILvypwoOgDZnxPCsAFm2g6W+JjZqvP0DaC5H2JHRXQdOrgg6UUJ02u/NNcQ12jwtixDSW5i4bgEp3QVEckBk37s/AbLcT5XsCzkxZBy+L6QBoLTq/OhdGWWn5iLUZwzjH7iZ8JNR/UGeT3WYU+pt2k9AMdnA/NP3HyTPAAmCM06qT0KB/4UaORXU7xaYFW62eyooqEZ+Oao6AyrE/fGkPfiYqFL+5DQHjmmw7VCuwwtfzph6UmFu6XYd31mIO04Eb0eKz1wO07bAVrdfAhlKNMgM3K9XDdVCDmKSob+w3QR/rb7uB6w79WPGhw1zAAInrOg== 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)(70206006)(83380400001)(70586007)(55016002)(6286002)(1076003)(356005)(7636003)(2906002)(6666004)(8676002)(4326008)(36756003)(336012)(54906003)(316002)(8936002)(16526019)(47076005)(86362001)(186003)(7696005)(26005)(2616005)(36860700001)(6916009)(508600001)(82310400003)(5660300002)(426003); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Oct 2021 23:46:20.8286 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e47050fb-097b-4789-3715-08d98c48295f 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: DM6NAM11FT057.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR12MB3415 Subject: [dpdk-dev] [PATCH v2 3/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 --- 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