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 B3A4CA0C47; Tue, 12 Oct 2021 10:07:18 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id B91FC41104; Tue, 12 Oct 2021 10:07:02 +0200 (CEST) Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2066.outbound.protection.outlook.com [40.107.92.66]) by mails.dpdk.org (Postfix) with ESMTP id 14FCC40150; Tue, 12 Oct 2021 10:07:00 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=gRumCJVh2hqnGulTZ/e/BlX5d2dE0l2oAtRuUAnGufXcuY0zaYlCNz+Bfm5ekjb+2jRWkQGx6bPtr2OqJSy6weVej13WP4yPfYyCqvzkFEEIuU19S2I9eeB/YXPiiUgZOLTYz2rpFRjyM/CRhQuFGK/Q9jNPw0jnvgWB0n6Jq0XY4/JXsyrPueumfFELQnJytBs33Gon2bUgLlWomFFVmfv5SJOOCvXlw1mu1nI9KXv7/oAmZEzdRBJufpBKWvWUKwCDo2hcAG3HkCriUsudtFBgzVVXQq1no9cIlv2dIFBIFB3WxDeTTqwRoRL5BnObrtrqak9yM8GIJdRJ745pAg== 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=VQu/gGzMe+CW/ExbhUODLGDb8leP6a8uRsNi+wmFRGSimypBi5+56XF4Vunp7WQafWWWnzcBAsjVSaLSikvPr5sWJxNq73Hr39TOYbST/v1htW/5I9fz9VwxiDnjtO7Q0MagtT6kLryE23xdMxPljKXMQhD/fxGsqlJB86Jt121tKvkxF6xBBlVYFfI4U3Ij0NLIY3o7QPDV1pIJP00ie7kBXKFSXkB2rNjIkOC1wYswvIkbLQtXldl9PQjPoDDq9RoP7kdPgP1UEzrdvy5pzs1lBujFBBsTwk5oAFYtprlOaMcbydNP1iTGktmzpuAHJEfLl3jo/sIQURCvSmi16A== 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=DwtK5zZzdFpm98nJdXVUqkIIayCb1KjEdnh+1l8t6lb8ZnfO0UPpF9l2GZDsGPTh/TB/skT3UNEfepYH4ZiSiqBSuDZLsBPuwCt06Nxdu+D5RR8DIypeFfMGTtCAfM6MO1p3NrTZvGdH6GL/1agv8KAaLmp3/80UP44LvvQbO4qFnw3VPpS+1RqK8/0Ed5r0Mp/mkjjQoCl/ZaExktIvsAC2CBlCdAMusaRJL8GGoC2k7X++HootUdtNm+Lf+RQ54K/4WdLPWK1DPnzOb7WNpCAZMu6OXv8kueAbITd+E6Hw7zJ6Sf7tHPLAV4O6/lhF4YS48Ebee8XbO+CuFODFTw== Received: from MWHPR1601CA0002.namprd16.prod.outlook.com (2603:10b6:300:da::12) by MN2PR12MB4989.namprd12.prod.outlook.com (2603:10b6:208:38::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4587.20; Tue, 12 Oct 2021 08:06:58 +0000 Received: from CO1NAM11FT053.eop-nam11.prod.protection.outlook.com (2603:10b6:300:da:cafe::d2) by MWHPR1601CA0002.outlook.office365.com (2603:10b6:300:da::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4587.18 via Frontend Transport; Tue, 12 Oct 2021 08:06:58 +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 CO1NAM11FT053.mail.protection.outlook.com (10.13.175.63) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4587.18 via Frontend Transport; Tue, 12 Oct 2021 08:06:57 +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; Tue, 12 Oct 2021 08:06:55 +0000 From: Viacheslav Ovsiienko To: CC: , , , , , , Date: Tue, 12 Oct 2021 11:06:30 +0300 Message-ID: <20211012080631.28504-5-viacheslavo@nvidia.com> X-Mailer: git-send-email 2.18.1 In-Reply-To: <20211012080631.28504-1-viacheslavo@nvidia.com> References: <20210910141609.8410-1-viacheslavo@nvidia.com> <20211012080631.28504-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: 0bc65271-921f-49b5-8c2e-08d98d57432f X-MS-TrafficTypeDiagnostic: MN2PR12MB4989: 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: miplFy9H0VQWvG0YnqP6eal8muOqBgZ0S9muJL6OpDoE3LZApgLpq0B2DYFaPKvA8coDgZgamO4KPQWsm9Emn7gJO7VgMFujNQXHUxWfrrVC0vYDQ9tRvveTJsQB0sO2i7ejo+sgGzHrX92Z1RyvTlUvDDPP8LeL0KkqOyUROMzGz7mdeAHJ3aLw+6T7FGz/+umVg0H/Co+aXdcqmOu93emmwx1CXPqiJMeXPAJjoI94LHiKGUwrqB3CfWp9cXfV/8VfOUr1OrppzI846uFIkL/5CIaqFJ/inxT14Gz0yx+IoOBBmxAyRd5h7qrj3yuiZVc+mxO6Zb7AYMgSxtMrtMpxlOSrVGPmWl6tvmhxWFuNBOpaRGj9wkcC0Uh3ywk+iaLTyUepidRw10KFETFGIHWliXR1hgk+xkr9wrUtZt0/zxhboz0frKxIGJu0V9In06PjC/tkUUW3n+EqofgODirR5pK8VUrauxdxcAiF2Tfqj6l+T6QOEKs2NfslP+DTjVr9hVSWkZd7OkQWP3mwNhSA4rO+utSVplSBmwFm3OZu9zbb2MluYanQR1XfbvDgpcuxjVXnCKMYHQIa4zpf+PebVU5aNZ9P3APCTeegatnAq5aYsWKbxSlcG8oSUGO4FjGLuRXf92pEy0eUgyqOKq70pNmFcmN3GKpdTXtWwLueMs4SDgy3lMCVTV7vXAA0Vx4ESjHsVm+4Y4T6EUw1oQ== 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)(5660300002)(86362001)(426003)(70586007)(1076003)(336012)(26005)(6916009)(508600001)(47076005)(2616005)(70206006)(54906003)(82310400003)(4326008)(8936002)(186003)(8676002)(356005)(83380400001)(36756003)(16526019)(55016002)(316002)(6666004)(36860700001)(6286002)(7636003)(2906002)(7696005); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Oct 2021 08:06:57.7497 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 0bc65271-921f-49b5-8c2e-08d98d57432f 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: CO1NAM11FT053.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR12MB4989 Subject: [dpdk-dev] [PATCH v3 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