diff options
author | Michael Stahl <Michael.Stahl@cib.de> | 2018-10-04 16:20:06 +0200 |
---|---|---|
committer | Julien Nabet <serval2412@yahoo.fr> | 2018-10-05 07:12:59 +0200 |
commit | 09841225fc055f8270cee3059253f923dd544797 (patch) | |
tree | 08d27c01d3a1c0c4536c41d0ff2108fbc4ae8daa /soltools | |
parent | Reformat this eye-cancer causing mess (diff) | |
download | core-09841225fc055f8270cee3059253f923dd544797.tar.gz core-09841225fc055f8270cee3059253f923dd544797.zip |
soltools: fix -Werror=format-overflow
error: ‘sprintf’ may write a terminating nul past the end of the destination
(Why does GCC8 complain about this now and not before?)
Change-Id: I62cd9dec02d313b5aff1afc4cadf38ca1909ffb1
Reviewed-on: https://gerrit.libreoffice.org/61381
Tested-by: Jenkins
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
Diffstat (limited to 'soltools')
-rw-r--r-- | soltools/mkdepend/include.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/soltools/mkdepend/include.c b/soltools/mkdepend/include.c index dbc282845435..26a237bc827e 100644 --- a/soltools/mkdepend/include.c +++ b/soltools/mkdepend/include.c @@ -30,6 +30,7 @@ in this Software without prior written authorization from the X Consortium. #include "def.h" #include <string.h> +#include <assert.h> static void remove_dotdot( char * ); static int isdot( char const * ); @@ -242,7 +243,9 @@ int issymbolic(char *dir, char *component) struct stat st; char buf[ BUFSIZ ], **pp; - sprintf(buf, "%s%s%s", dir, *dir ? "/" : "", component); + int n = snprintf(buf, BUFSIZ, "%s%s%s", dir, *dir ? "/" : "", component); + assert(n < BUFSIZ); + (void) n; for (pp=notdotdot; *pp; pp++) if (strcmp(*pp, buf) == 0) return TRUE; |