mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Shuah Khan <shuah@kernel.org>
To: julien.boibessot@free.fr,
	Valentina Manea <valentina.manea.m@gmail.com>,
	linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Shuah Khan <shuahkh@osg.samsung.com>,
	Shuah Khan <shuah@kernel.org>
Cc: Julien BOIBESSOT <julien.boibessot@armadeus.com>
Subject: Re: [PATCH] tools/usbip: fixes potential (minor) "buffer overflow" (detected on recent gcc with -Werror)
Date: Thu, 7 Dec 2017 10:23:48 -0700	[thread overview]
Message-ID: <9e2c6629-4059-dc08-ef2b-1af7692fd429@kernel.org> (raw)
In-Reply-To: <1512486544-32760-1-git-send-email-julien.boibessot@free.fr>

On 12/05/2017 08:09 AM, julien.boibessot@free.fr wrote:
> From: Julien BOIBESSOT <julien.boibessot@armadeus.com>
> 
> Fixes following build error:
> vhci_driver.c: In function 'refresh_imported_device_list':
> vhci_driver.c:118:37: error: 'snprintf' output may be truncated before
> 	the last format character [-Werror=format-truncation=]
>     snprintf(status, sizeof(status), "status.%d", i);
>                                      ^~~~~~~~~~~
> vhci_driver.c:118:4: note: 'snprintf' output between 9 and 18 bytes into
> 	a destination of size 17
>     snprintf(status, sizeof(status), "status.%d", i);
>     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> cc1: all warnings being treated as errors
> 
> Signed-off-by: Julien BOIBESSOT <julien.boibessot@armadeus.com>
> ---
>  tools/usb/usbip/libsrc/vhci_driver.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/tools/usb/usbip/libsrc/vhci_driver.c b/tools/usb/usbip/libsrc/vhci_driver.c
> index 5727dfb..a9ce431 100644
> --- a/tools/usb/usbip/libsrc/vhci_driver.c
> +++ b/tools/usb/usbip/libsrc/vhci_driver.c
> @@ -106,7 +106,7 @@ static int parse_status(const char *value)
>  	return 0;
>  }
>  
> -#define MAX_STATUS_NAME 16
> +#define MAX_STATUS_NAME 18
>  
>  static int refresh_imported_device_list(void)
>  {
> 

I have been thinking about this some and if it indeed a large
ncontrollers value that makes the buffer overflow, we might have
a bigger problem. That said, this patch looks good to fix the
warming.

Greg,

Could you please pick this patch up.

Acked-by: Shuah Khan <shuahkh@osg.samsung.com>

thanks,
-- Shuah

      reply	other threads:[~2017-12-07 17:24 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-05 15:09 julien.boibessot
2017-12-07 17:23 ` Shuah Khan [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=9e2c6629-4059-dc08-ef2b-1af7692fd429@kernel.org \
    --to=shuah@kernel.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=julien.boibessot@armadeus.com \
    --cc=julien.boibessot@free.fr \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=shuahkh@osg.samsung.com \
    --cc=valentina.manea.m@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

all inboxes | Powered by JetHome®