Re: [PATCH] staging: greybus: Use scnprintf() for avoiding potential buffer overflow

2020-03-12 Thread Johan Hovold
On Thu, Mar 12, 2020 at 05:51:11PM +0300, Dan Carpenter wrote: > On Wed, Mar 11, 2020 at 10:58:14AM +0100, Johan Hovold wrote: > > On Wed, Mar 11, 2020 at 10:19:06AM +0100, Takashi Iwai wrote: > > > Since snprintf() returns the would-be-output size instead of the > > > actual output size, the succe

Re: [PATCH] staging: greybus: Use scnprintf() for avoiding potential buffer overflow

2020-03-12 Thread Dan Carpenter
On Wed, Mar 11, 2020 at 10:58:14AM +0100, Johan Hovold wrote: > On Wed, Mar 11, 2020 at 10:19:06AM +0100, Takashi Iwai wrote: > > Since snprintf() returns the would-be-output size instead of the > > actual output size, the succeeding calls may go beyond the given > > buffer limit. Fix it by replac

Re: [PATCH] staging: greybus: Use scnprintf() for avoiding potential buffer overflow

2020-03-11 Thread Johan Hovold
On Wed, Mar 11, 2020 at 05:45:31PM +0100, Takashi Iwai wrote: > On Wed, 11 Mar 2020 17:40:02 +0100, Johan Hovold wrote: > > But isn't the first snprintf() in such a sequence as much a part of the > > problem as the following ones? > > > > If the first pos = snprintf(buf, limit, ...) overflows buf

Re: [PATCH] staging: greybus: Use scnprintf() for avoiding potential buffer overflow

2020-03-11 Thread Takashi Iwai
On Wed, 11 Mar 2020 17:40:02 +0100, Johan Hovold wrote: > > On Wed, Mar 11, 2020 at 12:01:26PM +0100, Takashi Iwai wrote: > > On Wed, 11 Mar 2020 11:09:03 +0100, > > Johan Hovold wrote: > > > > > > On Wed, Mar 11, 2020 at 11:02:33AM +0100, Takashi Iwai wrote: > > > > On Wed, 11 Mar 2020 10:58:14

Re: [PATCH] staging: greybus: Use scnprintf() for avoiding potential buffer overflow

2020-03-11 Thread Johan Hovold
On Wed, Mar 11, 2020 at 12:01:26PM +0100, Takashi Iwai wrote: > On Wed, 11 Mar 2020 11:09:03 +0100, > Johan Hovold wrote: > > > > On Wed, Mar 11, 2020 at 11:02:33AM +0100, Takashi Iwai wrote: > > > On Wed, 11 Mar 2020 10:58:14 +0100, > > > Johan Hovold wrote: > > > > > > > > On Wed, Mar 11, 2020

Re: [PATCH] staging: greybus: Use scnprintf() for avoiding potential buffer overflow

2020-03-11 Thread Takashi Iwai
On Wed, 11 Mar 2020 11:09:03 +0100, Johan Hovold wrote: > > On Wed, Mar 11, 2020 at 11:02:33AM +0100, Takashi Iwai wrote: > > On Wed, 11 Mar 2020 10:58:14 +0100, > > Johan Hovold wrote: > > > > > > On Wed, Mar 11, 2020 at 10:19:06AM +0100, Takashi Iwai wrote: > > > > Since snprintf() returns the

Re: [PATCH] staging: greybus: Use scnprintf() for avoiding potential buffer overflow

2020-03-11 Thread Johan Hovold
On Wed, Mar 11, 2020 at 11:02:33AM +0100, Takashi Iwai wrote: > On Wed, 11 Mar 2020 10:58:14 +0100, > Johan Hovold wrote: > > > > On Wed, Mar 11, 2020 at 10:19:06AM +0100, Takashi Iwai wrote: > > > Since snprintf() returns the would-be-output size instead of the > > > actual output size, the succe

Re: [PATCH] staging: greybus: Use scnprintf() for avoiding potential buffer overflow

2020-03-11 Thread Takashi Iwai
On Wed, 11 Mar 2020 10:58:14 +0100, Johan Hovold wrote: > > On Wed, Mar 11, 2020 at 10:19:06AM +0100, Takashi Iwai wrote: > > Since snprintf() returns the would-be-output size instead of the > > actual output size, the succeeding calls may go beyond the given > > buffer limit. Fix it by replacing

Re: [PATCH] staging: greybus: Use scnprintf() for avoiding potential buffer overflow

2020-03-11 Thread Johan Hovold
On Wed, Mar 11, 2020 at 10:19:06AM +0100, Takashi Iwai wrote: > Since snprintf() returns the would-be-output size instead of the > actual output size, the succeeding calls may go beyond the given > buffer limit. Fix it by replacing with scnprintf(). > > Signed-off-by: Takashi Iwai > --- > drive

[PATCH] staging: greybus: Use scnprintf() for avoiding potential buffer overflow

2020-03-11 Thread Takashi Iwai
Since snprintf() returns the would-be-output size instead of the actual output size, the succeeding calls may go beyond the given buffer limit. Fix it by replacing with scnprintf(). Signed-off-by: Takashi Iwai --- drivers/staging/greybus/tools/loopback_test.c | 24 1 fi