Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp840435pxb; Wed, 3 Nov 2021 13:19:23 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxIqadL1AvlSH44EI3431szXzRRD6nlNJPO7wvL8RdqP5Wn9eYncHleu0cJPO9WLDhDOdSR X-Received: by 2002:a05:6402:274f:: with SMTP id z15mr1943915edd.200.1635970763042; Wed, 03 Nov 2021 13:19:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635970763; cv=none; d=google.com; s=arc-20160816; b=GS2bg0Le3yxyTlxLnm2am8sUqJ84/NIhVYjS+nnQJyMfraRyq/9h61+LHLgTAzCoBH FdpM5/4Sro5ByRyKLqTzLOsnoYHGb/PRobVQAirDF5a/xMqdRMGXnjTIeDagGBJqtzy2 YyJaJh6QLWHac5pYS8u/u/NtGbCgxloNq4HKr6xkf4v/aHLenPA9yeD5KnCxbyQywSxI tY5bWXG145qUtkK4VGcmsJ5xYnNc/CvNu+Ko9XsSiC3ukk+fqvgVfTOcWelFJdltO0X6 wmWT8zTp7ZSGSoGXYCTpp0aNdYx5dRS0EDPHAA0EhuF/QB795gBb1A5qLZTjz0hQWlqA qWaA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=q+C7wljZH/Dr/GA0aUp3tMpK4uhWl5lS9FlBtDFtDfg=; b=P4wpsV0yxupL3HwLE7wubxIp+F90Ox6kL3684Zbc/I0Yx/xwauVv1og9U9jPJ9XNCA mnMO40Bb0qlWv1N6ORcjeEtnmaAMZuZ7P7I9JggF3JtYuGCc5eS3BqlcLNqNtLou6dp+ Fv3h7+s3pHfcV2k6U72aTo5wx7M8W3Cuw027GEwD46hO6FYWivnn85Lia7YWd/4eCsLu mf+bw36SpoEzVXa9yG7XUkNFn1ir4imcAlaXZCrSvskyzF7F5qj71auso68Hu/Cbk6zw 0hcqMb7t52mO1S5x/tn7dUio1QLzKZ9WNzivTgwsZTjIA+vN7HEOFovtrMNCHE1odmFw EYFQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id jy1si4560590ejc.140.2021.11.03.13.19.06; Wed, 03 Nov 2021 13:19:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231588AbhKCUU6 (ORCPT + 66 others); Wed, 3 Nov 2021 16:20:58 -0400 Received: from mout-p-101.mailbox.org ([80.241.56.151]:30018 "EHLO mout-p-101.mailbox.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231440AbhKCUU4 (ORCPT ); Wed, 3 Nov 2021 16:20:56 -0400 Received: from smtp102.mailbox.org (smtp102.mailbox.org [80.241.60.233]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-p-101.mailbox.org (Postfix) with ESMTPS id 4Hkykx1D5bzQk1x; Wed, 3 Nov 2021 21:18:17 +0100 (CET) X-Virus-Scanned: amavisd-new at heinlein-support.de From: =?UTF-8?q?Jonas=20Dre=C3=9Fler?= To: Amitkumar Karwar , Ganapathi Bhat , Xinming Hu , Kalle Valo , "David S. Miller" , Jakub Kicinski Cc: =?UTF-8?q?Jonas=20Dre=C3=9Fler?= , Tsuchiya Yuto , linux-wireless@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Maximilian Luz , Andy Shevchenko , Bjorn Helgaas , =?UTF-8?q?Pali=20Roh=C3=A1r?= Subject: [PATCH v4 3/3] mwifiex: Ensure the version string from the firmware is 0-terminated Date: Wed, 3 Nov 2021 21:18:00 +0100 Message-Id: <20211103201800.13531-4-verdre@v0yd.nl> In-Reply-To: <20211103201800.13531-1-verdre@v0yd.nl> References: <20211103201800.13531-1-verdre@v0yd.nl> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 0550FC0A Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org We assume at a few places that priv->version_str is 0-terminated, but right now we trust the firmware that this is the case with the version string we get from it. Let's rather ensure this ourselves and replace the last character with '\0'. Signed-off-by: Jonas Dreßler --- drivers/net/wireless/marvell/mwifiex/sta_cmdresp.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/net/wireless/marvell/mwifiex/sta_cmdresp.c b/drivers/net/wireless/marvell/mwifiex/sta_cmdresp.c index 6c7b0b9bc4e9..1a4ae8a42a31 100644 --- a/drivers/net/wireless/marvell/mwifiex/sta_cmdresp.c +++ b/drivers/net/wireless/marvell/mwifiex/sta_cmdresp.c @@ -734,6 +734,9 @@ static int mwifiex_ret_ver_ext(struct mwifiex_private *priv, MWIFIEX_VERSION_STR_LENGTH); memcpy(priv->version_str, ver_ext->version_str, MWIFIEX_VERSION_STR_LENGTH); + + /* Ensure the version string from the firmware is 0-terminated */ + priv->version_str[MWIFIEX_VERSION_STR_LENGTH - 1] = '\0'; } return 0; } -- 2.33.1