From 19c9e4f7372d3f643c15f35f944c3ae4c984ec66 Mon Sep 17 00:00:00 2001 From: tomcruiseqi <10762123+tomcruiseqi@user.noreply.gitee.com> Date: Wed, 9 Jul 2025 17:06:11 +0800 Subject: [PATCH] [CVE] CVE-2024-45782 to #19713 add patch to fix CVE-2024-45782 Project: TC2024080204 Signed-off-by: tomcruiseqi <10762123+tomcruiseqi@user.noreply.gitee.com> --- 1-bugfix-for-CVE-2024-45782.patch | 34 +++++++++++++++++++++++++++++++ grub2.spec | 7 ++++++- 2 files changed, 40 insertions(+), 1 deletion(-) create mode 100644 1-bugfix-for-CVE-2024-45782.patch diff --git a/1-bugfix-for-CVE-2024-45782.patch b/1-bugfix-for-CVE-2024-45782.patch new file mode 100644 index 0000000..fbf42d9 --- /dev/null +++ b/1-bugfix-for-CVE-2024-45782.patch @@ -0,0 +1,34 @@ +From 417547c10410b714e43f08f74137c24015f8f4c3 Mon Sep 17 00:00:00 2001 +From: B Horn +Date: Sun, 12 May 2024 02:48:33 +0100 +Subject: [PATCH 03/73] fs/hfs: Fix stack OOB write with grub_strcpy() + +Replaced with grub_strlcpy(). + +Fixes: CVE-2024-45782 +Fixes: CVE-2024-56737 +Fixes: https://savannah.gnu.org/bugs/?66599 + +Reported-by: B Horn +Signed-off-by: B Horn +Reviewed-by: Daniel Kiper +--- + grub-core/fs/hfs.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/grub-core/fs/hfs.c b/grub-core/fs/hfs.c +index 91dc0e69c..920112b03 100644 +--- a/grub-core/fs/hfs.c ++++ b/grub-core/fs/hfs.c +@@ -379,7 +379,7 @@ grub_hfs_mount (grub_disk_t disk) + volume name. */ + key.parent_dir = grub_cpu_to_be32_compile_time (1); + key.strlen = data->sblock.volname[0]; +- grub_strcpy ((char *) key.str, (char *) (data->sblock.volname + 1)); ++ grub_strlcpy ((char *) key.str, (char *) (data->sblock.volname + 1), sizeof (key.str)); + + if (grub_hfs_find_node (data, (char *) &key, data->cat_root, + 0, (char *) &dir, sizeof (dir)) == 0) +-- +2.33.0 + diff --git a/grub2.spec b/grub2.spec index 3e561cb..46e5901 100644 --- a/grub2.spec +++ b/grub2.spec @@ -1,4 +1,4 @@ -%define anolis_release 13 +%define anolis_release 14 %global _lto_cflags %{nil} %undefine _hardened_build @@ -31,6 +31,7 @@ Source10: 20-grub.install Source11: grub.patches Source12: sbat.csv.in +Patch1: 1-bugfix-for-CVE-2024-45782.patch %include %{SOURCE1} BuildRequires: gcc efi-srpm-macros @@ -163,6 +164,7 @@ This subpackage provides the GRUB user-space emulation modules. %endif %prep +%autosetup -p1 %do_common_setup %if 0%{with_efi_arch} mkdir grub-%{grubefiarch}-%{tarversion} @@ -506,6 +508,9 @@ mv ${EFI_HOME}/grub.cfg.stb ${EFI_HOME}/grub.cfg %endif %changelog +* Wed Jul 09 2025 tomcruiseqi - 2.12-14 +- Fix CVE-2024-45782 + * Thu Jun 5 2025 Xue Liu - 2.12-13 - Disable vector instructions for loongarch -- Gitee