Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp6027639pxv; Thu, 29 Jul 2021 04:48:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzcj4qdEMabCcsmvKU77fvaznKwvIMAACT+svAPKI1ea82tECtC77PRuWEcfugqI/ZpVf6m X-Received: by 2002:a17:906:6cb:: with SMTP id v11mr4222670ejb.482.1627559330414; Thu, 29 Jul 2021 04:48:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1627559330; cv=none; d=google.com; s=arc-20160816; b=zVqaeMQLvGqs9eFGW/Iy+qkJBYjX/zAirsqySs4bPi1OQ2u3v5PFWMHeh/H6KQUirl +xqKTo6dCh5RqW/ArnbFuwCR1+tFDHgSOj0Lk5WJhvsQE4GQkEJHjsr6JWsjGLjuAvZ0 +lNHeFcHRQLC2b/m/+XUhO836IYKtqGs16dRq6SkQ45LbnLpvv/xQlaXeXEHyFb6j+YE aeo1xwchBIKWJDaC4wRu49ANQg7jmx7Tzhr3z2TVaJzfaqwNseNVjCgMZn6JngKWKf5E LzJAM6dKEeJB8OkEqQxpsIOyjQQQxfs+CHrUDf83mjXcDfxtvLvgaGK6kSg0g0Z8L5xY THDw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:to:references:message-id :content-transfer-encoding:cc:date:in-reply-to:from:subject :mime-version; bh=q9xtSJzfdFrzvq0d8kJ+EqYLoviuDUYoRqL5pG/tf6M=; b=N3ElN8DD+JgDcAZD6WyQUOiFIqhz8iFsXcMTuwIQNm+QBdQCNZvLuuzL6YgyKeXRe7 4irlzd/fT4mLY5/QgTrFNTuP4KXkN9VhB43rWt4od/37XL7xwNvinUNPtrppHyOFkDLV LkwHrCjdda1vxi42S2N1Q2iIPC/SxxAMYFLkRVSgxSrWWFnVDpkvO+8WYEM1spDAPbvs g1OUxuRI3Flh1VIRpZe7ZCRPvteYzdBf9RSHJM8yKndVIJlQ9GmnjOmvGA8G50a+uQ1c tTemZOin33qkURB5VG+CBvVGx8YD2DH7/5JNzFM68tCB6DOO16qBnWIPsohzoYr5YE6c thEw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-bluetooth-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 h25si2804844edq.396.2021.07.29.04.48.26; Thu, 29 Jul 2021 04:48:50 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-bluetooth-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-bluetooth-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234041AbhG2Lra (ORCPT + 99 others); Thu, 29 Jul 2021 07:47:30 -0400 Received: from coyote.holtmann.net ([212.227.132.17]:54032 "EHLO mail.holtmann.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229869AbhG2Lr3 (ORCPT ); Thu, 29 Jul 2021 07:47:29 -0400 Received: from smtpclient.apple (p5b3d23f8.dip0.t-ipconnect.de [91.61.35.248]) by mail.holtmann.org (Postfix) with ESMTPSA id 6D42CCED14; Thu, 29 Jul 2021 13:47:25 +0200 (CEST) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.100.0.2.22\)) Subject: Re: [PATCH v2] drivers/bluetooth: Remove all strcpy() uses From: Marcel Holtmann In-Reply-To: <20210724122152.7133-1-len.baker@gmx.com> Date: Thu, 29 Jul 2021 13:47:25 +0200 Cc: Kees Cook , Johan Hedberg , Luiz Augusto von Dentz , Adam Sampson , linux-bluetooth@vger.kernel.org, linux-kernel@vger.kernel.org, linux-hardening@vger.kernel.org Content-Transfer-Encoding: 7bit Message-Id: References: <20210724122152.7133-1-len.baker@gmx.com> To: Len Baker X-Mailer: Apple Mail (2.3654.100.0.2.22) Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org Hi Len, > strcpy() performs no bounds checking on the destination buffer. This > could result in linear overflows beyond the end of the buffer, leading > to all kinds of misbehaviors. The safe replacement is strscpy() but in > this case it is better to use the scnprintf to simplify the arithmetic. > > This is a previous step in the path to remove the strcpy() function > entirely from the kernel. > > Signed-off-by: Len Baker > --- > Changelog v1 -> v2 > - Add spaces to the "plus" sign. > - Use the correct size for the fw_dump_ptr buffer (Adam Sampson) > > drivers/bluetooth/btmrvl_sdio.c | 29 ++++++++++++++--------------- > 1 file changed, 14 insertions(+), 15 deletions(-) patch has been applied to bluetooth-next tree. Regards Marcel