From 09841225fc055f8270cee3059253f923dd544797 Mon Sep 17 00:00:00 2001 From: Michael Stahl Date: Thu, 4 Oct 2018 16:20:06 +0200 Subject: soltools: fix -Werror=format-overflow MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- soltools/mkdepend/include.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'soltools') 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 +#include 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; -- cgit