summaryrefslogtreecommitdiff
path: root/m4/hardening.m4
diff options
context:
space:
mode:
authorTodd C. Miller <Todd.Miller@sudo.ws>2023-04-26 12:44:10 -0600
committerTodd C. Miller <Todd.Miller@sudo.ws>2023-04-26 12:44:10 -0600
commit802c59f1a6aed8732d73893a126b43c38f3d1258 (patch)
tree7fa0529a59acc4d51f41cbc658dc581c8af7d900 /m4/hardening.m4
parent565801b83539f08d74b73da74cbd22f41331cce8 (diff)
downloadsudo-802c59f1a6aed8732d73893a126b43c38f3d1258.tar.gz
Add missing stdio.h include for the _FORTIFY_SOURCE=2 check.
Implementations of _FORTIFY_SOURCE require the header file to be included. Also remove the useless test of an empty program with _FORTIFY_SOURCE defined. Pointed out by Florian Weimer.
Diffstat (limited to 'm4/hardening.m4')
-rw-r--r--m4/hardening.m49
1 files changed, 2 insertions, 7 deletions
diff --git a/m4/hardening.m4 b/m4/hardening.m4
index f7d2a8c29..45c501ff7 100644
--- a/m4/hardening.m4
+++ b/m4/hardening.m4
@@ -10,18 +10,13 @@ AC_DEFUN([SUDO_CHECK_HARDENING], [
[sudo_cv_use_fortify_source],
[AC_LINK_IFELSE([
AC_LANG_PROGRAM(
- [[]], [[char buf[4]; (void)sprintf(buf, "%s", "foo");]]
+ [[#include <stdio.h>]],
+ [[char buf[4]; sprintf(buf, "%s", "foo"); return buf[0];]]
)],
[sudo_cv_use_fortify_source=yes],
[sudo_cv_use_fortify_source=no]
)
]
- [AC_LINK_IFELSE(
- [AC_LANG_PROGRAM([[]], [[]])],
- [sudo_cv_use_fortify_source=yes],
- [sudo_cv_use_fortify_source=no]
- )
- ]
)
if test "$sudo_cv_use_fortify_source" != yes; then
CPPFLAGS="$O_CPPFLAGS"