The test was converted to C++ but the custom flags used to build it were
left in the CFLAGS variable which doesn't apply to C++ code. This begs
the question of the usefulness of these flags, except for POPT_CFLAGS
which lead to this finding.
Change-Id: I87412ff0730b960b191d8725a13407c67f7b431d
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
noinst_PROGRAMS = select_poll_epoll
select_poll_epoll_SOURCES = select_poll_epoll.cpp
select_poll_epoll_LDADD = $(POPT_LIBS) $(top_builddir)/src/common/libcommon-lgpl.la
-select_poll_epoll_CFLAGS = $(POPT_CFLAGS) -fno-stack-protector -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=0 $(AM_CFLAGS)
+select_poll_epoll_CPPFLAGS = $(POPT_CFLAGS) $(AM_CPPFLAGS)
+# Disable stack protection, the test overflows the stack to test the poll/epoll syscalls
+select_poll_epoll_CXXFLAGS = -fno-stack-protector $(AM_CXXFLAGS)
all-local:
@if [ x"$(srcdir)" != x"$(builddir)" ]; then \
*
*/
+/*
+ * This test voluntarily does buffer overflows and stack overruns, disable
+ * source fortification.
+ */
+#ifdef _FORTIFY_SOURCE
+#undef _FORTIFY_SOURCE
+#endif
+
#include <fcntl.h>
#include <limits.h>
#include <poll.h>