All of lore.kernel.org
 help / color / mirror / Atom feed
From: Abdul Rahim <abdul.rahim@myyahoo.com>
To: krzk@kernel.org
Cc: Abdul Rahim <abdul.rahim@myyahoo.com>,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH] nfc: s3fwrn5: Prefer strscpy() over strcpy()
Date: Wed, 30 Oct 2024 03:46:34 +0530	[thread overview]
Message-ID: <20241029221641.15726-1-abdul.rahim@myyahoo.com> (raw)
In-Reply-To: 20241029221641.15726-1-abdul.rahim.ref@myyahoo.com

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 [1]

this fixes checkpatch warning:
	WARNING: Prefer strscpy over strcpy

Link: https://www.kernel.org/doc/html/latest/process/deprecated.html#strcpy [1]
Signed-off-by: Abdul Rahim <abdul.rahim@myyahoo.com>
---
 drivers/nfc/s3fwrn5/firmware.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/nfc/s3fwrn5/firmware.c b/drivers/nfc/s3fwrn5/firmware.c
index c20fdbac51c5..85fa84d93883 100644
--- a/drivers/nfc/s3fwrn5/firmware.c
+++ b/drivers/nfc/s3fwrn5/firmware.c
@@ -469,7 +469,7 @@ void s3fwrn5_fw_init(struct s3fwrn5_fw_info *fw_info, const char *fw_name)
 	fw_info->parity = 0x00;
 	fw_info->rsp = NULL;
 	fw_info->fw.fw = NULL;
-	strcpy(fw_info->fw_name, fw_name);
+	strscpy(fw_info->fw_name, fw_name);
 	init_completion(&fw_info->completion);
 }
 
-- 
2.46.0


       reply	other threads:[~2024-10-29 22:37 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20241029221641.15726-1-abdul.rahim.ref@myyahoo.com>
2024-10-29 22:16 ` Abdul Rahim [this message]
2024-10-30  5:57   ` [PATCH] nfc: s3fwrn5: Prefer strscpy() over strcpy() Krzysztof Kozlowski
2024-11-25 20:41     ` Abdul Rahim
2024-11-26  6:38       ` Krzysztof Kozlowski
2024-11-26  8:49         ` Abdul Rahim
2024-11-26  9:22           ` Krzysztof Kozlowski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20241029221641.15726-1-abdul.rahim@myyahoo.com \
    --to=abdul.rahim@myyahoo.com \
    --cc=krzk@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.