Kaydet (Commit) 7a77d77e authored tarafından Stephan Bergmann's avatar Stephan Bergmann

Use a C99 flexible array member

...so the following strcpy does not cause a false abort under _FORTIFY_SOURCE=2

Change-Id: I395136f11020064766db76f87ed8f5b01c083c3a
Reviewed-on: https://gerrit.libreoffice.org/18681Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarStephan Bergmann <sbergman@redhat.com>
üst 23d4d2f6
......@@ -162,7 +162,7 @@ typedef struct defbuf
char* repl; /* -> replacement */
int hash; /* Symbol table hash */
int nargs; /* For define(args) */
char name[1]; /* #define name */
char name[]; /* #define name */
} DEFBUF;
/*
......
......@@ -613,7 +613,7 @@ DEFBUF* defendel(char* name, int delete)
}
if (!delete)
{
dp = (DEFBUF*) getmem(sizeof (DEFBUF) + size);
dp = (DEFBUF*) getmem(sizeof (DEFBUF) + size + 1);
dp->link = *prevp;
*prevp = dp;
dp->hash = nhash;
......
......@@ -81,6 +81,8 @@ gb_AFLAGS := $(AFLAGS)
# C4189: 'identifier' : local variable is initialized but not referenced
# C4200: nonstandard extension used : zero-sized array in struct/union
# C4201: nonstandard extension used : nameless struct/union
# C4242: 'identifier' : conversion from 'type1' to 'type2', possible
......@@ -150,6 +152,7 @@ gb_CFLAGS := \
$(if $(filter 0,$(gb_DEBUGLEVEL)),-wd4100) \
-wd4127 \
$(if $(filter 0,$(gb_DEBUGLEVEL)),-wd4189) \
-wd4200 \
-wd4242 \
-wd4244 \
-wd4251 \
......
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