summaryrefslogtreecommitdiff
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
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.
-rwxr-xr-xconfigure26
-rw-r--r--m4/hardening.m49
2 files changed, 4 insertions, 31 deletions
diff --git a/configure b/configure
index b5d57d6dc..2a8b219b4 100755
--- a/configure
+++ b/configure
@@ -34207,33 +34207,11 @@ else case e in #(
e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
-
-int
-main (void)
-{
-char buf[4]; (void)sprintf(buf, "%s", "foo");
-
- ;
- return 0;
-}
-_ACEOF
-if ac_fn_c_try_link "$LINENO"
-then :
- sudo_cv_use_fortify_source=yes
-else case e in #(
- e) sudo_cv_use_fortify_source=no
- ;;
-esac
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.beam \
- conftest$ac_exeext conftest.$ac_ext
-
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-
+ #include <stdio.h>
int
main (void)
{
+char buf[4]; sprintf(buf, "%s", "foo"); return buf[0];
;
return 0;
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"