Re: [PATCH v4 1/2] usbip: Fix-format-overflow

2017-03-16 Thread Jonathan Dieter
On Mon, 2017-02-27 at 10:31 +0200, Jonathan Dieter wrote: > The usbip userspace tools call sprintf()/snprintf() and don't check for > the return value which can lead the paths to overflow, truncating the > final file in the path. > > More urgently, GCC 7 now warns that these

[PATCH v4 1/2] usbip: Fix-format-overflow

2017-02-27 Thread Jonathan Dieter
, that makes these tools unbuildable. This patch fixes these problems by replacing sprintf() with snprintf() in one place and adding checks for the return value of snprintf(). Reviewed-by: Peter Senna Tschudin <peter.se...@gmail.com> Signed-off-by: Jonathan Dieter <jdie...@lesbg.com> --- Chan

[PATCH v4 2/2] usbip: Fix implicit fallthrough warning

2017-02-27 Thread Jonathan Dieter
.se...@gmail.com> Signed-off-by: Jonathan Dieter <jdie...@lesbg.com> --- tools/usb/usbip/src/usbip.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tools/usb/usbip/src/usbip.c b/tools/usb/usbip/src/usbip.c index d7599d9..73d8eee 100644 --- a/tools/usb/usbip/src/usbip.c +++ b/tools/usb/usbip

[PATCH v3 1/2] usbip: Fix-format-overflow

2017-02-22 Thread Jonathan Dieter
, that makes these tools unbuildable. This patch fixes these problems by replacing sprintf() with snprintf() in one place and adding checks for the return value of snprintf(). Reviewed-by: Peter Senna Tschudin <peter.se...@gmail.com> Signed-off-by: Jonathan Dieter <jdie...@lesbg.com> --- Chan

[PATCH v3 2/2] usbip: Fix implicit fallthrough warning

2017-02-22 Thread Jonathan Dieter
.se...@gmail.com> Signed-off-by: Jonathan Dieter <jdie...@lesbg.com> --- tools/usb/usbip/src/usbip.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tools/usb/usbip/src/usbip.c b/tools/usb/usbip/src/usbip.c index d7599d9..73d8eee 100644 --- a/tools/usb/usbip/src/usbip.c +++ b/tools/usb/usbip

Re: [PATCH v2 1/2] usbip: Fix-format-overflow

2017-02-22 Thread Jonathan Dieter
On Wed, 2017-02-22 at 06:49 +0100, Krzysztof Opasiak wrote: > Hi, > > W dniu 2017-02-21 o 18:57, Jonathan Dieter pisze: > >   char busid[SYSFS_BUS_ID_SIZE]; > > + unsigned int size; > > I'm not really convinced to use unsigned here. snprintf() is declared > to 

[PATCH v2 1/2] usbip: Fix-format-overflow

2017-02-21 Thread Jonathan Dieter
, that makes these tools unbuildable. This patch fixes these problems by replacing sprintf() with snprintf() in one place and adding checks for the return value of snprintf(). Reviewed-by: Peter Senna Tschudin <peter.se...@gmail.com> Signed-off-by: Jonathan Dieter <jdie...@lesbg.com> --- too

[PATCH v2 2/2] usbip: Fix implicit fallthrough warning

2017-02-21 Thread Jonathan Dieter
.se...@gmail.com> Signed-off-by: Jonathan Dieter <jdie...@lesbg.com> --- tools/usb/usbip/src/usbip.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tools/usb/usbip/src/usbip.c b/tools/usb/usbip/src/usbip.c index d7599d9..73d8eee 100644 --- a/tools/usb/usbip/src/usbip.c +++ b/tools/usb/usbip

Re: [PATCH 1/2] Fix format overflows

2017-02-21 Thread Jonathan Dieter
On Tue, 2017-02-21 at 08:48 +0200, Jonathan Dieter wrote: > On Tue, 2017-02-21 at 07:12 +0100, Krzysztof Opasiak wrote: > > Hi, > >   > > W dniu 2017-02-20 o 21:51, Jonathan Dieter pisze:  > > > + err("busid length %i >= SYSFS_BUS_ID_SIZE", >

Re: [PATCH 1/2] Fix format overflows

2017-02-20 Thread Jonathan Dieter
Thanks for looking at this. One quick question before I put out version two with your corrections: On Tue, 2017-02-21 at 07:12 +0100, Krzysztof Opasiak wrote: > Hi, >  > W dniu 2017-02-20 o 21:51, Jonathan Dieter pisze: > > The usbip userspace tools call sprintf()/snprintf()

[PATCH 2/2] Fix implicit fallthrough warning

2017-02-20 Thread Jonathan Dieter
.se...@gmail.com> Signed-off-by: Jonathan Dieter <jdie...@lesbg.com> --- tools/usb/usbip/src/usbip.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tools/usb/usbip/src/usbip.c b/tools/usb/usbip/src/usbip.c index d7599d9..73d8eee 100644 --- a/tools/usb/usbip/src/usbip.c +++ b/tools/usb/usbip

[PATCH 1/2] Fix format overflows

2017-02-20 Thread Jonathan Dieter
, that makes these tools unbuildable. This patch fixes these problems by replacing sprintf() with snprintf() in one place and adding checks for the return value of snprintf(). Reviewed-by: Peter Senna Tschudin <peter.se...@gmail.com> Signed-off-by: Jonathan Dieter <jdie...@lesbg.com> --- too