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 2C3F94567F; Mon, 22 Jul 2024 13:00:20 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 55A5E40E50; Mon, 22 Jul 2024 13:00:15 +0200 (CEST) Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.10]) by mails.dpdk.org (Postfix) with ESMTP id 617984027F for ; Mon, 22 Jul 2024 12:59:56 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1721645997; x=1753181997; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=GkS6Yct0EcgUFg1iNl1d+QS8xAZhNJmV0hSh6Wl4RLY=; b=VDmHdXH7KQofZE4lrBgNXNKJaYD7jAjaNoXvlolMmpFRQbfXKqEjitSZ hisKoP+baoj6PyyBR606mBjMy86Oke11dd8HsK4TGFSQj0Ib5mGTYciZk 2MSTZsWZh0WYK7BYe58xB04lGz+Nr9m/ujvfXNPCs53O+W59VjW7/Dej4 8H35NzwwPz91/YB7mx7bfRGRoqdi8IcnwrezQp9ZADZQBPcdkGla1lzYG gWkOJcCkl3M94cJtUf8IZktjXa5vfgJKl24lX7iDUkEkB5GMQ2BK+vudA w5ehBknVNBIETgG/g7fw0ViUE3h/RY35o8bz0pKbuddXTrAyO9HFuiRoR g==; X-CSE-ConnectionGUID: m4cWC6q0RTqRPxB0M+aZ0w== X-CSE-MsgGUID: 7vHMTz9vTiei1CwhPF8fXQ== X-IronPort-AV: E=McAfee;i="6700,10204,11140"; a="36650482" X-IronPort-AV: E=Sophos;i="6.09,227,1716274800"; d="scan'208";a="36650482" Received: from orviesa008.jf.intel.com ([10.64.159.148]) by orvoesa102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Jul 2024 03:59:56 -0700 X-CSE-ConnectionGUID: ecSNK415SM2/sisYsokQng== X-CSE-MsgGUID: Xlyl5uylRIuyuP2RPV0yNA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.09,227,1716274800"; d="scan'208";a="52579724" Received: from unknown (HELO silpixa00401176.ir.intel.com) ([10.243.22.170]) by orviesa008.jf.intel.com with ESMTP; 22 Jul 2024 03:59:55 -0700 From: Vladimir Medvedkin To: dev@dpdk.org Cc: bruce.richardson@intel.com Subject: [PATCH v4 2/3] net/ice: refactor raw pattern parsing function Date: Mon, 22 Jul 2024 10:59:49 +0000 Message-Id: <20240722105950.199804-2-vladimir.medvedkin@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240722105950.199804-1-vladimir.medvedkin@intel.com> References: <20240722082836.176515-1-vladimir.medvedkin@intel.com> <20240722105950.199804-1-vladimir.medvedkin@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 Replace strlen with more secure strnlen in ice_hash_parse_raw_pattern. Signed-off-by: Vladimir Medvedkin --- drivers/net/ice/ice_hash.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/net/ice/ice_hash.c b/drivers/net/ice/ice_hash.c index 6b3095e2c5..506ea261e8 100644 --- a/drivers/net/ice/ice_hash.c +++ b/drivers/net/ice/ice_hash.c @@ -658,9 +658,9 @@ ice_hash_parse_raw_pattern(struct ice_adapter *ad, raw_spec = item->spec; raw_mask = item->mask; - spec_len = strlen((char *)(uintptr_t)raw_spec->pattern); - if (strlen((char *)(uintptr_t)raw_mask->pattern) != - spec_len) + spec_len = strnlen((char *)(uintptr_t)raw_spec->pattern, raw_spec->length); + if (strnlen((char *)(uintptr_t)raw_mask->pattern, raw_spec->length) != + spec_len) return -rte_errno; pkt_len = spec_len / 2; -- 2.34.1