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

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", >

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

2017-02-21 Thread Jonathan Dieter
: Jonathan Dieter --- 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/src/usbip.c @@ -176,6 +176,8 @@ int main(int argc, char

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

2017-02-21 Thread Jonathan Dieter
e.ac, 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 Signed-off-by: Jonathan Dieter --- tools/usb/usbip/libsrc/usbip_common.c

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 >

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

2017-02-22 Thread Jonathan Dieter
e.ac, 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 Signed-off-by: Jonathan Dieter --- Changes since v2 * Converted size back to i

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

2017-02-22 Thread Jonathan Dieter
: Jonathan Dieter --- 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/src/usbip.c @@ -176,6 +176,8 @@ int main(int argc, char

[PATCH 2/2] Fix implicit fallthrough warning

2017-02-20 Thread Jonathan Dieter
: Jonathan Dieter --- 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/src/usbip.c @@ -176,6 +176,8 @@ int main(int argc, char

[PATCH 1/2] Fix format overflows

2017-02-20 Thread Jonathan Dieter
e.ac, 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 Signed-off-by: Jonathan Dieter --- tools/usb/usbip/libsrc/usbip_common.c

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 v4 2/2] usbip: Fix implicit fallthrough warning

2017-02-27 Thread Jonathan Dieter
: Jonathan Dieter --- 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/src/usbip.c @@ -176,6 +176,8 @@ int main(int argc, char

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

2017-02-27 Thread Jonathan Dieter
e.ac, 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 Signed-off-by: Jonathan Dieter --- Changes since v3 * Cast sizeof to long uns