Re: [Linuxptp-devel] [PATCH] clock: fix possible buffer overrun

2017-05-21 Thread Richard Cochran
On Tue, May 16, 2017 at 04:56:48PM +0200, Petr Kulhavy wrote: > This is not a fix of an actual issue rather than prevention of a potential > issue. > On two places a fixed array size (different to the actual size) is used in > snprintf. > Replace with sizeof(array) I merged this change, but I

Re: [Linuxptp-devel] [PATCH] clock: fix possible buffer overrun

2017-05-16 Thread Keller, Jacob E
> -Original Message- > From: Richard Cochran [mailto:richardcoch...@gmail.com] > Sent: Tuesday, May 16, 2017 1:19 PM > To: Petr Kulhavy <br...@jikos.cz> > Cc: linuxptp-devel@lists.sourceforge.net > Subject: Re: [Linuxptp-devel] [PATCH] clock: fix possible buffer ove

Re: [Linuxptp-devel] [PATCH] clock: fix possible buffer overrun

2017-05-16 Thread Petr Kulhavy
That's what I mean. The size in snprintf() includes the terminating 0. That's why I replaced it with sizeof. And that's why I wrote in the commit message that there is no actual issue, rather than a potential. ... when someone changes the size of the buffer downwards. Cheers Petr On 16/05/17

Re: [Linuxptp-devel] [PATCH] clock: fix possible buffer overrun

2017-05-16 Thread Richard Cochran
On Tue, May 16, 2017 at 09:58:19PM +0200, Petr Kulhavy wrote: > Did I miss something? What is the reason then? Never mind, this is snprintf() and not strncpy(). The original code was confused and misleading using 31 (but not really incorrect either). Thanks, Richard

Re: [Linuxptp-devel] [PATCH] clock: fix possible buffer overrun

2017-05-16 Thread Petr Kulhavy
Did I miss something? What is the reason then? Petr On 16/05/17 21:54, Richard Cochran wrote: > On Tue, May 16, 2017 at 04:56:48PM +0200, Petr Kulhavy wrote: >> This is not a fix of an actual issue rather than prevention of a potential >> issue. > No, your patch introduces an issue that wasn't

Re: [Linuxptp-devel] [PATCH] clock: fix possible buffer overrun

2017-05-16 Thread Richard Cochran
On Tue, May 16, 2017 at 04:56:48PM +0200, Petr Kulhavy wrote: > This is not a fix of an actual issue rather than prevention of a potential > issue. No, your patch introduces an issue that wasn't there before. > @@ -1589,7 +1589,7 @@ int clock_switch_phc(struct clock *c, int phc_index) >

Re: [Linuxptp-devel] [PATCH] clock: fix possible buffer overrun

2017-05-16 Thread Keller, Jacob E
> -Original Message- > From: Petr Kulhavy [mailto:br...@jikos.cz] > Sent: Tuesday, May 16, 2017 7:57 AM > To: linuxptp-devel@lists.sourceforge.net > Subject: [Linuxptp-devel] [PATCH] clock: fix possible buffer overrun > > This is not a fix of an actual issue r

[Linuxptp-devel] [PATCH] clock: fix possible buffer overrun

2017-05-16 Thread Petr Kulhavy
This is not a fix of an actual issue rather than prevention of a potential issue. On two places a fixed array size (different to the actual size) is used in snprintf. Replace with sizeof(array) Signed-off-by: Petr Kulhavy --- clock.c | 4 ++-- 1 file changed, 2 insertions(+),