diff options
author | Todd C. Miller <Todd.Miller@sudo.ws> | 2023-04-26 12:44:10 -0600 |
---|---|---|
committer | Todd C. Miller <Todd.Miller@sudo.ws> | 2023-04-26 12:44:10 -0600 |
commit | 802c59f1a6aed8732d73893a126b43c38f3d1258 (patch) | |
tree | 7fa0529a59acc4d51f41cbc658dc581c8af7d900 | |
parent | 565801b83539f08d74b73da74cbd22f41331cce8 (diff) | |
download | sudo-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-x | configure | 26 | ||||
-rw-r--r-- | m4/hardening.m4 | 9 |
2 files changed, 4 insertions, 31 deletions
@@ -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" |