diff --git a/backport-Set-command_info-to-NULL-once-it-is-freed.patch b/backport-Set-command_info-to-NULL-once-it-is-freed.patch new file mode 100644 index 0000000000000000000000000000000000000000..54049086123b1d1ab39610cbbe029b58d07fb395 --- /dev/null +++ b/backport-Set-command_info-to-NULL-once-it-is-freed.patch @@ -0,0 +1,25 @@ +From 0bb41ed82a5849b0c64d7046662825d84e983e4d Mon Sep 17 00:00:00 2001 +From: Rose <83477269+AtariDreams@users.noreply.github.com> +Date: Mon, 26 Jun 2023 15:08:51 -0400 +Subject: [PATCH] Set command_info to NULL once it is freed + +The lack of setting to NULL is a holdover from when command_info was a local variable and not a global one. However, we given how other global variables are set to NULL, it is best that we do the same here to avoid potential issues should sudoers_policy_store_result be called again after the first time failed, otherwise we could get a double-free. + +--- + plugins/sudoers/policy.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/plugins/sudoers/policy.c b/plugins/sudoers/policy.c +index 7157fab2b..f018caca2 100644 +--- a/plugins/sudoers/policy.c ++++ b/plugins/sudoers/policy.c +@@ -1054,6 +1054,7 @@ bad: + while (info_len--) + free(command_info[info_len]); + free(command_info); ++ command_info = NULL; + debug_return_bool(false); + } + +-- +2.23.0 \ No newline at end of file diff --git a/sudo.spec b/sudo.spec index 3a0d2cea957723371e060ec172189681ec39a208..09aa2f9999be88ec7d8047b5137aa3fcd196bcf5 100644 --- a/sudo.spec +++ b/sudo.spec @@ -1,6 +1,6 @@ Name: sudo Version: 1.9.8p2 -Release: 13 +Release: 14 Summary: Allows restricted root access for specified users License: ISC URL: http://www.courtesan.com/sudo/ @@ -37,6 +37,7 @@ Patch23: backport-sudoers_main-defer-setting-return-value-until-the-en.patch Patch24: backport-sudo_putenv_nodebug-require-that-the-environment-str.patch Patch25: backport-Linux-execve-2-allows-argv-or-envp-to-be-NULL.patch Patch26: backport-Fix-potential-NULL-pointer-deference-found-by-clang-.patch +Patch27: backport-Set-command_info-to-NULL-once-it-is-freed.patch Buildroot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) Requires: pam @@ -187,6 +188,9 @@ install -p -c -m 0644 %{SOURCE3} $RPM_BUILD_ROOT/etc/pam.d/sudo-i %exclude %{_pkgdocdir}/ChangeLog %changelog +* Mon Aug 07 2023 zhoushuiqing - 1.9.8p2-14 +- Backport patche from upstream community + * Tue Jun 13 2023 zhoushuiqing - 1.9.8p2-13 - Backport patches from upstream community