Linux USB
 help / color / mirror / Atom feed
From: Greg KH <gregkh@linuxfoundation.org>
To: Yiyuan Guo <yguoaz@gmail.com>
Cc: dan.scally@ideasonboard.com, andriy.shevchenko@linux.intel.com,
	frank.li@nxp.com, christophe.jaillet@wanadoo.fr,
	jgilab@gmail.com, chanh@os.amperecomputing.com,
	linux-usb@vger.kernel.org
Subject: Re: [PATCH] usb: gadget: configfs: Prevent buffer overrun in usb_string_copy
Date: Fri, 30 Jun 2023 14:17:47 +0200	[thread overview]
Message-ID: <2023063013-fanning-crafty-4502@gregkh> (raw)
In-Reply-To: <20230630110401.2360746-1-yguoaz@gmail.com>

On Fri, Jun 30, 2023 at 07:04:01PM +0800, Yiyuan Guo wrote:
> In usb_string_copy(), when `strlen(s) == 0`, `str[ret - 1]` accesses at
> index -1. Add a check to prevent buffer overrun when `s` is empty.

It's an underrun, right?

And how can strlen(s) ever be 0 here?

How did you test this and how did you trigger it?

And what commit id does this fix?

And how was this found?

thanks,

greg k-h

  reply	other threads:[~2023-06-30 12:17 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-30 11:04 [PATCH] usb: gadget: configfs: Prevent buffer overrun in usb_string_copy Yiyuan Guo
2023-06-30 12:17 ` Greg KH [this message]
2023-06-30 13:13   ` yguoaz
2023-06-30 19:48     ` Greg KH
2023-07-01  3:48       ` yguoaz

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=2023063013-fanning-crafty-4502@gregkh \
    --to=gregkh@linuxfoundation.org \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=chanh@os.amperecomputing.com \
    --cc=christophe.jaillet@wanadoo.fr \
    --cc=dan.scally@ideasonboard.com \
    --cc=frank.li@nxp.com \
    --cc=jgilab@gmail.com \
    --cc=linux-usb@vger.kernel.org \
    --cc=yguoaz@gmail.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