Kaydet (Commit) 09841225 authored tarafından Michael Stahl's avatar Michael Stahl Kaydeden (comit) Julien Nabet

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: 's avatarJulien Nabet <serval2412@yahoo.fr>
üst e539a492
...@@ -30,6 +30,7 @@ in this Software without prior written authorization from the X Consortium. ...@@ -30,6 +30,7 @@ in this Software without prior written authorization from the X Consortium.
#include "def.h" #include "def.h"
#include <string.h> #include <string.h>
#include <assert.h>
static void remove_dotdot( char * ); static void remove_dotdot( char * );
static int isdot( char const * ); static int isdot( char const * );
...@@ -242,7 +243,9 @@ int issymbolic(char *dir, char *component) ...@@ -242,7 +243,9 @@ int issymbolic(char *dir, char *component)
struct stat st; struct stat st;
char buf[ BUFSIZ ], **pp; 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++) for (pp=notdotdot; *pp; pp++)
if (strcmp(*pp, buf) == 0) if (strcmp(*pp, buf) == 0)
return TRUE; return TRUE;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment