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 and 14 bytes into a destination of size 10 sprintf (buf, "[%d]", info); ^~~~~~~~~~~~~~~~~~~~~~~~~~~
* find/ftsfind.c (get_fts_info_name): Increase buffer from 10 to 14 to be able to hold the 11-char string representation of the %d format, the surrounding '[' and ']', plus the terminating NULL character. --- find/ftsfind.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/find/ftsfind.c b/find/ftsfind.c index 607ea8d3..57804950 100644 --- a/find/ftsfind.c +++ b/find/ftsfind.c @@ -143,7 +143,7 @@ static void init_mounted_dev_list (void); static const char * get_fts_info_name (int info) { - static char buf[10]; + static char buf[14]; switch (info) { HANDLECASE(FTS_D); -- 2.18.0