2
0
mirror of https://github.com/sudo-project/sudo.git synced 2025-08-22 01:49:11 +00:00

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.
This commit is contained in:
Todd C. Miller 2023-04-26 12:44:10 -06:00
parent b83140e0f1
commit 075ee0f9dc
2 changed files with 4 additions and 31 deletions

26
configure vendored
View File

@ -34207,33 +34207,11 @@ else case e in #(
e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */ /* end confdefs.h. */
#include <stdio.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. */
int int
main (void) main (void)
{ {
char buf[4]; sprintf(buf, "%s", "foo"); return buf[0];
; ;
return 0; return 0;

View File

@ -10,18 +10,13 @@ AC_DEFUN([SUDO_CHECK_HARDENING], [
[sudo_cv_use_fortify_source], [sudo_cv_use_fortify_source],
[AC_LINK_IFELSE([ [AC_LINK_IFELSE([
AC_LANG_PROGRAM( 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=yes],
[sudo_cv_use_fortify_source=no] [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 if test "$sudo_cv_use_fortify_source" != yes; then
CPPFLAGS="$O_CPPFLAGS" CPPFLAGS="$O_CPPFLAGS"