Re: [PATCH] ftsfind.c: avoid buffer overflow in -D code

2018-07-09 Thread Bernhard Voelker
On 07/09/2018 05:23 PM, Jim Meyering wrote: > On Mon, Jul 9, 2018 at 5:57 AM, Bernhard Voelker > wrote: >> On 07/08/2018 06:19 AM, Jim Meyering wrote: >>> On Sat, Jul 7, 2018 at 4:13 PM, Bernhard Voelker >>> wrote: - static char buf[10]; + static char buf[14]; >>> >>> Or maybe this, s

Re: [PATCH] ftsfind.c: avoid buffer overflow in -D code

2018-07-09 Thread Jim Meyering
On Mon, Jul 9, 2018 at 5:57 AM, Bernhard Voelker wrote: > On 07/08/2018 06:19 AM, Jim Meyering wrote: >> On Sat, Jul 7, 2018 at 4:13 PM, Bernhard Voelker >> wrote: >>> - static char buf[10]; >>> + static char buf[14]; >> >> Or maybe this, since you already use the intprops module, just add >> t

Re: [PATCH] ftsfind.c: avoid buffer overflow in -D code

2018-07-09 Thread Bernhard Voelker
On 07/08/2018 06:19 AM, Jim Meyering wrote: > On Sat, Jul 7, 2018 at 4:13 PM, Bernhard Voelker > wrote: >> - static char buf[10]; >> + static char buf[14]; > > Or maybe this, since you already use the intprops module, just add > this somewhere prior: #include "intprops.h" > > static char buf

Re: [PATCH] ftsfind.c: avoid buffer overflow in -D code

2018-07-07 Thread Jim Meyering
On Sat, Jul 7, 2018 at 4:13 PM, Bernhard Voelker wrote: > Reported by GCC 8.1.1: > > ftsfind.c: In function ‘get_fts_info_name’: > ftsfind.c:164:23: warning: ‘%d’ directive writing between 1 and 11 bytes into > a region of size 9 [-Wformat-overflow=] >sprintf (buf, "[%d]", info); >

[PATCH] ftsfind.c: avoid buffer overflow in -D code

2018-07-07 Thread Bernhard Voelker
Reported by GCC 8.1.1: ftsfind.c: In function ‘get_fts_info_name’: ftsfind.c:164:23: warning: ‘%d’ directive writing between 1 and 11 bytes into a region of size 9 [-Wformat-overflow=] sprintf (buf, "[%d]", info); ^~ ftsfind.c:164:7: note: ‘sprintf’ output between 4