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 5359CA0032; Fri, 1 Oct 2021 21:53:11 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id B3FC14122F; Fri, 1 Oct 2021 21:52:55 +0200 (CEST) Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2040.outbound.protection.outlook.com [40.107.237.40]) by mails.dpdk.org (Postfix) with ESMTP id D37CE411D9; Fri, 1 Oct 2021 21:52:54 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Qg71F2ySGc1iR5vzdTeVMiTAc1uSTDoBFPLXxhSrTK89csfE5hUOR48aimuZp7yr14aIRGhUFTjW9CSugloYjNW8XXwLIyZ/tYB3xxSTIJdzU1zj4xXIP4JjG+y3klBpNumdOHNWHKG3d7HMbnbvPL+ZGdbCVwAulSJk1JIrISNircYoPTnE/hlIGcaQ5bWJINtlXfegZvotAEiSbLfYRdvo//fKpenr8hL++ktQMaIWzLtwJB0xL3/WKdxZPPqdhe7aUjNi6z2RAgpJ/uu4QwuEekaHWYPLkOOd2OTWUKgAwZygvbgmkf0PH5ylWmxCNP2wHhIAoUn4uHOoFoXD6A== 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=VO4nsQQZBSl4EdBv9p7uOe6M+7oahAHJ1G7zcFFy+BFWR2h4u9EAjOolXRRZrpabVL0gPLMXHsUDP+soDs8R8r2m6vQ6lmxeOqOs4gXNI3cxdMJzdJqwHU4rzEJOeQKbi1e48TQUUJjlLUvWVKdVYZ37NBvW6UobrhArEvziL5uAfGSEGHG84vCaZy4nJDAAuyGBR39PwGL11ohnokBPcdyZuak2x4N1ZYZVHzBwKOnHJhQz20Ch7QrS+xW8F/dtZQPGqszNo9HsJ6Wycb5Oax0/4CnlgLUsjqa6ZAi4bE9tzl7Krc8oGWhaVvLVClxU6z0Igeim857uFcYSNnGogw== 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=hzAUU/2ivxRQJSHhpOTf0+QOeSxNxS/B4tF7rkbAfRZB/FPg89xgSBxFTnXS99lk20VYFL+ws9tcfMSrWAQNWRk7RlFaazn2vf3+7VQGA2UF1LlbQC1ljltUAVxLhe8PLUJkzsoaYIySxmvtT93+VPjd6ZBLqavhgxENxy94mmqYqmJp/T+YeA3EMMyCqt6jCXaQEBtPVqGx0zztURxttqli3ATvKnaC12/pALDDuMbrYL6InuG2Zy29who0HPnxxUd5uh4zDBIYCtwX3m3POceP+wS/4d5RDTFKQ2X57ViycGO+iBKP065nx6jIQi/6fhyvzcvcJmx37zY/0kLmBA== Received: from CO2PR04CA0149.namprd04.prod.outlook.com (2603:10b6:104::27) by MN2PR12MB4255.namprd12.prod.outlook.com (2603:10b6:208:198::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4566.13; Fri, 1 Oct 2021 19:52:53 +0000 Received: from CO1NAM11FT060.eop-nam11.prod.protection.outlook.com (2603:10b6:104:0:cafe::b7) by CO2PR04CA0149.outlook.office365.com (2603:10b6:104::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4566.17 via Frontend Transport; Fri, 1 Oct 2021 19:52:53 +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 CO1NAM11FT060.mail.protection.outlook.com (10.13.175.132) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4566.14 via Frontend Transport; Fri, 1 Oct 2021 19:52:52 +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; Fri, 1 Oct 2021 19:52:50 +0000 From: Viacheslav Ovsiienko To: CC: , , , , , , Date: Fri, 1 Oct 2021 22:52:23 +0300 Message-ID: <20211001195223.31909-4-viacheslavo@nvidia.com> X-Mailer: git-send-email 2.18.1 In-Reply-To: <20211001195223.31909-1-viacheslavo@nvidia.com> References: <20210910141609.8410-1-viacheslavo@nvidia.com> <20211001195223.31909-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: 5c6ea3cd-b664-4485-312d-08d985150e33 X-MS-TrafficTypeDiagnostic: MN2PR12MB4255: 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: 9zAm4Wd5RF/1XMf9GSVXoqGIb738LcnlZNibjPQqfiBs4De5UdswZ3+rXAuCKP1n1oePU74k++RH4dgj3PxJp8bryiNOW3Me9RaZ466/amJrzY9H30ftmbyDwtQOXOZzhDLJeIHEaxUIPcDScZyb0pBEbPBTctz1NLxIYFm8tP0ZnjZnNTXcWkXHsD+tUSal0K4gpO4c2OPEYkoX6oFK+PxhUAqT6/VMhO8zEy7f50j1PK3Q5OuWHGN8yoJt6Qn/S2EDH2BIxaYCsWQudiuxeaCmPaNlEiJE8qdri9mXvXlEkLYGhPnFgePeSEUM1t9zDG4xpL+HvF+fVz6W0E+zWp1xNQNXasY24+VmG/6e/jS1bi6OQTfEiICPKeUoZXjKeoQHZrqaFBCF/JEXa7SnJ12ZHqg6DLQols0TcDP+Hxk3VyLvewYJaFXBIcresi1hHxbGSycEy+r15Sx9q+/Xajz/qkk6eGRyKaa3BWUXLNZ+mEjadM6Q5oyehyrlHnLAGevreQ0hr4dk4xALhsDM/FedUg5qZu5v1cqzddbPG7G8v+YLdx4Gf4l4vTx6lHtqmPpQx+YqgLtB+joTjsgw3N2Z5wXMS0rk0Juycu7HyKjmffz7XNpMhphg5wR6VDLOe9xMXdm3xDnss+/bBQ8JIC2twcuBJG4gxSIOSNyFEnS8S8QRrpS/GLqoEEFJ6q16Ta5kxhHcQObhVU8sMOBE4g== 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)(6286002)(508600001)(55016002)(2906002)(6916009)(186003)(1076003)(54906003)(8936002)(7696005)(16526019)(2616005)(426003)(336012)(4326008)(36906005)(316002)(26005)(8676002)(5660300002)(47076005)(86362001)(36756003)(70586007)(70206006)(83380400001)(36860700001)(82310400003)(7636003)(6666004)(356005); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Oct 2021 19:52:52.7469 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 5c6ea3cd-b664-4485-312d-08d985150e33 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: CO1NAM11FT060.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR12MB4255 Subject: [dpdk-dev] [PATCH 3/3] 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