[Libreoffice-commits] core.git: soltools/mkdepend

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Fri Oct 5 05:13:24 UTC 2018


 soltools/mkdepend/include.c |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

New commits:
commit 09841225fc055f8270cee3059253f923dd544797
Author:     Michael Stahl <Michael.Stahl at cib.de>
AuthorDate: Thu Oct 4 16:20:06 2018 +0200
Commit:     Julien Nabet <serval2412 at yahoo.fr>
CommitDate: Fri Oct 5 07:12:59 2018 +0200

    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 at yahoo.fr>

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;


More information about the Libreoffice-commits mailing list