summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2015-09-18 11:16:54 +0200
committerStephan Bergmann <sbergman@redhat.com>2015-09-18 13:15:27 +0000
commit7a77d77effdace1b234062dd7bb035026c893a8b (patch)
treec1181f8167e21fb2a4760a739a4d0b0c4aeca111
parent23d4d2f6ac5aa2ca94109e07421a1ed8330b85bd (diff)
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/18681 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
-rw-r--r--rsc/source/rscpp/cpp.h2
-rw-r--r--rsc/source/rscpp/cpp6.c2
-rw-r--r--solenv/gbuild/platform/com_MSC_defs.mk3
3 files changed, 5 insertions, 2 deletions
diff --git a/rsc/source/rscpp/cpp.h b/rsc/source/rscpp/cpp.h
index 1f88f7bff819..d0432ed5ec14 100644
--- a/rsc/source/rscpp/cpp.h
+++ b/rsc/source/rscpp/cpp.h
@@ -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;
/*
diff --git a/rsc/source/rscpp/cpp6.c b/rsc/source/rscpp/cpp6.c
index 74340ddc2b38..3678caa65378 100644
--- a/rsc/source/rscpp/cpp6.c
+++ b/rsc/source/rscpp/cpp6.c
@@ -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;
diff --git a/solenv/gbuild/platform/com_MSC_defs.mk b/solenv/gbuild/platform/com_MSC_defs.mk
index ab67e64b89cb..be9d9234e400 100644
--- a/solenv/gbuild/platform/com_MSC_defs.mk
+++ b/solenv/gbuild/platform/com_MSC_defs.mk
@@ -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 \