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 A890DA0C47; Tue, 12 Oct 2021 12:50:09 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id EE22D4116C; Tue, 12 Oct 2021 12:49:51 +0200 (CEST) Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2069.outbound.protection.outlook.com [40.107.243.69]) by mails.dpdk.org (Postfix) with ESMTP id 5C38C4116C; Tue, 12 Oct 2021 12:49:49 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=CVX5fT/+Ms97nZqReyLq6x7S60NJQ3fDqF+WvpwWu/6td4OZlhfqzLuXo+uzdUS0v8Zuj1/N2lHFOKzfBxQldRGDSu4GlKLY7rx2MPzF6QkKaoUnOKnVMONQ4moQnYK6B6KYWh/edS1x9vOfwQraEt0Exf03rRYxVOm4xAMW2WxmG60COdDt2pToXqiXcVAc9z8hynyAK9KckyVyh8tCliXLcbtWYszWvtL40PXG8psMifAa591O9/cBgPR2iV89QNoxGfeOjJbr+2XQNVzYk04yChb4w04Akr2cp+ggGKxLg+Fi4CMFn9i77JHkdv4gB5nv4CYQesnATpasK2QcfQ== 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=REgR+ue4VjJeXR2R9cVMAYeNY3Q6ZzjEhFaxH4wzMdBhvOhvj3ucfUSRSYgRtQxGrK4KMreVnbeD6/ayb0RmbQqu6m0TKiRDu/d4DyHEjX4YAUQiO3kiJlGULgKqOChuMGAErxRKetsTZpRBnRWLKSVQlu07VlVDvULl9ko8xosTI3P2jJGZc4A72IG/idSub4wuWa9EC/DMpFtipfsH9JXzYcY3QidVFNfjdGrmAqh06HaTIXdhmneZ2CmcslQ3or5r+1Wawq4+PaXHnA8TuomuDsLCXrh0OjKUt9+kXpFY1eKLsNxfS9VOrKVGxB0O1vMty9k5ZxuA9OtLpGaDmA== 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=m4oG+LDyucE0Q7um7/HZx/82FAZWreW9vS5SX9vIOOgOVdO88BQSw1QT4+4WdZ0/ZKQqxH+axEXsBjpXiWpQfn+L60e7Pjx0PPuRPwssV21GN1VJ69fUuE9naBjEgwqQhlDnIiWjEsZmVHTtBmXIAJ7LDmyKUWGBxg5lgDsH9YJYRVm+SXQbQmNS0c0TH6+9wxvhSCRZEJx/mdfLxcFkVTvOO+F55H4QBqoStca7igUfFzO0Wej7Yfn/KA/2IEhMyrKMk+x40SMUvAHyERpJf3mK7Fz61zP8BGf/eYx707PyNowbVPfQrCv7CyyLbIX6K0N7rfghXV40i8a9mA9xGQ== Received: from BN0PR07CA0007.namprd07.prod.outlook.com (2603:10b6:408:141::24) by SN1PR12MB2528.namprd12.prod.outlook.com (2603:10b6:802:28::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4587.26; Tue, 12 Oct 2021 10:49:47 +0000 Received: from BN8NAM11FT031.eop-nam11.prod.protection.outlook.com (2603:10b6:408:141:cafe::e5) by BN0PR07CA0007.outlook.office365.com (2603:10b6:408:141::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4587.25 via Frontend Transport; Tue, 12 Oct 2021 10:49:47 +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 BN8NAM11FT031.mail.protection.outlook.com (10.13.177.25) 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 10:49:47 +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; Tue, 12 Oct 2021 10:49:45 +0000 From: Viacheslav Ovsiienko To: CC: , , , , , , Date: Tue, 12 Oct 2021 13:49:18 +0300 Message-ID: <20211012104919.13145-5-viacheslavo@nvidia.com> X-Mailer: git-send-email 2.18.1 In-Reply-To: <20211012104919.13145-1-viacheslavo@nvidia.com> References: <20210922180418.20663-1-viacheslavo@nvidia.com> <20211012104919.13145-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: da08c311-6b7c-4b1c-ee15-08d98d6e025d X-MS-TrafficTypeDiagnostic: SN1PR12MB2528: 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: hNvcnF5fdy9ede1cXU0yoswdqNoZCH+6DFtXDl41j4GWXywgbPdMteFWqOW12G5V3gRFU8LmLwlzBBS2Jk/j8UmH6FKNWNFLLlWgM+1qSRzcO2CTRDWRoiMgmsQxTm8+Wm5ORdSkEO663RlbSeZOZhlrnORpEb9XreHVHGXNmR5ysyKuBQBCaBlQET/yyiwmziGw0tGxhAbDDtdPhlWCkHgjn1vEKcgrp3o0Z+LcM1jnHfsmGU9yCyKeCTu0DAsEs2S5BMB+nfsGxYFUOSFsBpnfJxIsf28Ca0fc2JgCKOPdrVLQfQJidtLK/NxoZICxbBccR+tAJVqOkfk4K1wdAQbkuGPjuwalgelMx4N+hDAYBgvGQfJ3OVLTT+AyFd1K88llFg0OxbwheNzCktSEUBdP3vC5x3v20R9OeyFTgLl9j/7xuTLu/iwoj7DfyCyOu06iH9qCZWLRGIJjpWWsLD4pXvJALewyEHJ/NYEqYb6hMhO9PdD3Hy6rC1Gogr9IZgbv+1H3wT83uajvz2SDqHBjiWVnyI6gEltOni64WLqqsH8kBZ/kKZdy/aRPw/t4NQGPx1eVH2qrEL5l83qEBAmjvWVSRBhFIhyrQWfOfgNk4P+BPBPS1DlgiiOg8RlZXSco/9PmMPrPyZtrBSbevrTLjZXo+vr/mfXJDjjOwT+a9+N6ah9KSo+Jehn+cqoUXHjv+UvoKWEKJj7ihdtu5w== 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)(356005)(1076003)(70206006)(36860700001)(86362001)(16526019)(186003)(47076005)(26005)(8936002)(70586007)(2906002)(336012)(8676002)(2616005)(426003)(7636003)(6666004)(5660300002)(83380400001)(6286002)(36756003)(54906003)(316002)(4326008)(55016002)(508600001)(7696005)(6916009)(82310400003); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Oct 2021 10:49:47.2726 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: da08c311-6b7c-4b1c-ee15-08d98d6e025d 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: BN8NAM11FT031.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN1PR12MB2528 Subject: [dpdk-dev] [PATCH v4 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