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 B71D2A0C4C; Tue, 12 Oct 2021 22:26:39 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C8F974114D; Tue, 12 Oct 2021 22:26:26 +0200 (CEST) Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2050.outbound.protection.outlook.com [40.107.94.50]) by mails.dpdk.org (Postfix) with ESMTP id 0CDCD4114D; Tue, 12 Oct 2021 22:26:25 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=SBvil9yuZJZl5v/GOajlwGX2MwWQdaeqbhLmN0u/asaPBGLSDBwCGNJNUaTjLwGmgkZEh4tvuhXFuJFVU/rWzN31pGM0uVyErO05CgYAKkSyU0vtxO5IkgikX/tjFlihYrYS81nCP8EVCqWq41avGfIs0N9d1E9y6mKScLYauUYQGNEulVADEG17jGyFBN5E2Zco2c8JWh/qPFncRsR9Zb6IA9tjsf80AZqv+FCgmgSnjDyqrv5rYebRIcF5cwWgktRKwsBO1bu52YnIHy+/7Yv6NhhvhFibm1FW1ZVbgveVicPjUCHlgoimloTO7xbJgxseO3AtMtmA5EVYImk5sQ== 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=jG9Fiw4UYZksM3I+W8MhUrkHef7kU15HWx37IES1KLADYup/nCvg14bUzuS7T5FgmcMFm4OpJGXcX9MxDGWi46pcNGo7S3SU5sDG9kyXWzTnse1NZzAUBKQKkyznNo8vZA8vhzrCDaU41UrdMho/OPE+dr5s16cgOP0/qCYHM5pXmHC0yw5q7N/zmEkFm70WXqZ9ojvPfDTCebmwOxaJme3tBDLmyKyvNVMWRhvzZf9IPIAwVNO3/EcR4mSmOrSfM9BnnrW8OVULZfI3EEXHnjTT4hCSJf0ujrMl4GMGQhOB5vLPMqx3tRGXn7H9x7rjo3LfYcssGF7+4m0RzY6M0Q== 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=JkFQAbKTXUgu1uap6MVf6L6PciSPtMf9e0WjsUGNzh/4qfvn7XjO6PA6f7hUdUR/31N3aiHp2V7Jcvk2QSMdx5o+gVDV9iF+pfQaC+E/AHjZNBk81DPlqhDlJBN0U/oiRLwkBORWAVz1ae8w+ogoZdl6PVJh6/IwqF9DHvTeDGVDuCEA1A3qbsLrqh4MQFkFw8iF1+8t/tT0jokfojB7U+N0QTdgvlrQpzb7adDmfhluzXWFoZmhcDiEYqLjZBKchgLwqOVhg2X/XtX01KPLN+kcR2tKQ0V8vPrwXgA/2VNwseWEp+dVb8Mfrj4jOk/iQR2THm/Dwn8QMicPBBgGbA== Received: from DM6PR13CA0043.namprd13.prod.outlook.com (2603:10b6:5:134::20) by CY4PR1201MB0040.namprd12.prod.outlook.com (2603:10b6:910:1b::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4587.18; Tue, 12 Oct 2021 20:26:23 +0000 Received: from DM6NAM11FT013.eop-nam11.prod.protection.outlook.com (2603:10b6:5:134:cafe::38) by DM6PR13CA0043.outlook.office365.com (2603:10b6:5:134::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4608.14 via Frontend Transport; Tue, 12 Oct 2021 20:26:23 +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 DM6NAM11FT013.mail.protection.outlook.com (10.13.173.142) 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 20:26:22 +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 20:26:19 +0000 From: Viacheslav Ovsiienko To: CC: , , , , , , Date: Tue, 12 Oct 2021 23:25:56 +0300 Message-ID: <20211012202557.30295-5-viacheslavo@nvidia.com> X-Mailer: git-send-email 2.18.1 In-Reply-To: <20211012202557.30295-1-viacheslavo@nvidia.com> References: <20210910141609.8410-1-viacheslavo@nvidia.com> <20211012202557.30295-1-viacheslavo@nvidia.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [172.20.187.5] X-ClientProxiedBy: HQMAIL107.nvidia.com (172.20.187.13) To HQMAIL107.nvidia.com (172.20.187.13) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 68070fdd-c8b2-4589-3a56-08d98dbe8ec8 X-MS-TrafficTypeDiagnostic: CY4PR1201MB0040: 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: u0nIt9Ua8BYTijzyfb2qsc+IkaleivKf4GKowQdys43niNDgL4XT51DQtKEQ07HWp1q1U6LEVjNssP/hwlZIUBjN/a9otwCY3JJzL6gfstr4DV+A6Ye9f20jzgF8Besb8Prm02ZTJ78TaajjaxSeaXTVOJL86zKIvpIxG7hWq8d+BXUConDbq053MKdnNwt7L3PHtd+8dGGkLMmGVspfqsdLgjGVIAzNgpcG+ivwuQ87KnMD6b6zVqAo7qd/oPV440mkeX87RZhkoh+UqQKGgd4eXDxqrEDqcQPBa6vX7JA4H5YFI7v0bLxg3Ts4gRITaQu+/h9qH6FNS7PuILa5on2HaeAZG4BkQeXIYH+7UUCfdvs1YbTfk0cQqKJO53uNMJxmLwWpPhL4jO/HdrHlsvZqxchnk68KIkYEc6H3XhR4koBG7gevpYv+WtIGkVFz/pImPfwAYHGr3ykufhJforGyzCFEUl0QfGjwldjrH7CMkHcmDCwE0hMpFQzqdQy/9gcd+UiTDSkRpBYEF7bKHtzD/v9mliT4UP7hUgpel0GfPoF+Z67nf56xNoxjSAt7gtmrbvlLsBA+Z99pK35GW+VpMVqKswqP8vnvCWOHhpopUvWl0Trd6Ht5SALoO2ca2WBUsnSB8HFUszW4UCsenADK2irXWTZTqA64a415z1SARvDEXkjzBaoJT3YCMuU+E0hotuWl0AUTa/xQPIN17g== 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)(6916009)(36756003)(7636003)(356005)(186003)(4326008)(316002)(55016002)(54906003)(5660300002)(508600001)(16526019)(1076003)(26005)(8936002)(8676002)(6666004)(6286002)(70586007)(70206006)(426003)(7696005)(336012)(86362001)(2906002)(36860700001)(83380400001)(2616005)(82310400003)(47076005); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Oct 2021 20:26:22.7305 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 68070fdd-c8b2-4589-3a56-08d98dbe8ec8 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: DM6NAM11FT013.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR1201MB0040 Subject: [dpdk-dev] [PATCH v5 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