public inbox for linux-usb@vger.kernel.org
 help / color / mirror / Atom feed
From: Kees Cook <kees@kernel.org>
To: Abdul Rahim <abdul.rahim@myyahoo.com>
Cc: gregkh@linuxfoundation.org, m.grzeschik@pengutronix.de,
	quic_jjohnson@quicinc.com, gustavoars@kernel.org,
	linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] usb: gadget: f_midi: prefer strscpy() over strcpy()
Date: Tue, 17 Sep 2024 01:30:32 -0700	[thread overview]
Message-ID: <202409170130.C9F169D4@keescook> (raw)
In-Reply-To: <20240914231756.503521-1-abdul.rahim@myyahoo.com>

On Sun, Sep 15, 2024 at 04:47:49AM +0530, Abdul Rahim wrote:
> The function strcpy() is depreciated and potentially unsafe. It 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() [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>

Yup, these look good. Thanks!

Reviewed-by: Kees Cook <kees@kernel.org>

-- 
Kees Cook

      reply	other threads:[~2024-09-17  8:30 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20240914231756.503521-1-abdul.rahim.ref@myyahoo.com>
2024-09-14 23:17 ` [PATCH] usb: gadget: f_midi: prefer strscpy() over strcpy() Abdul Rahim
2024-09-17  8:30   ` Kees Cook [this message]

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=202409170130.C9F169D4@keescook \
    --to=kees@kernel.org \
    --cc=abdul.rahim@myyahoo.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=gustavoars@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=m.grzeschik@pengutronix.de \
    --cc=quic_jjohnson@quicinc.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox