* [PATCH] tools/usbip: fixes potential (minor) "buffer overflow" (detected on recent gcc with -Werror)
@ 2017-12-05 15:09 julien.boibessot
2017-12-07 17:23 ` Shuah Khan
0 siblings, 1 reply; 2+ messages in thread
From: julien.boibessot @ 2017-12-05 15:09 UTC (permalink / raw)
To: Valentina Manea, Shuah Khan, linux-usb, linux-kernel; +Cc: Julien BOIBESSOT
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)
{
--
2.1.4
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] tools/usbip: fixes potential (minor) "buffer overflow" (detected on recent gcc with -Werror)
2017-12-05 15:09 [PATCH] tools/usbip: fixes potential (minor) "buffer overflow" (detected on recent gcc with -Werror) julien.boibessot
@ 2017-12-07 17:23 ` Shuah Khan
0 siblings, 0 replies; 2+ messages in thread
From: Shuah Khan @ 2017-12-07 17:23 UTC (permalink / raw)
To: julien.boibessot, Valentina Manea, linux-usb, linux-kernel,
Greg Kroah-Hartman, Shuah Khan, Shuah Khan
Cc: Julien BOIBESSOT
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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-12-07 17:24 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-12-05 15:09 [PATCH] tools/usbip: fixes potential (minor) "buffer overflow" (detected on recent gcc with -Werror) julien.boibessot
2017-12-07 17:23 ` Shuah Khan
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®