From 8ab6258a689bd75b8915162dcab9908298fb982b Mon Sep 17 00:00:00 2001 From: volcanodragon Date: Sun, 7 Apr 2024 17:06:33 +0800 Subject: [PATCH] Fix potential NULL dereference in ped_disk_next_partition --- ...-remove-patch-which-modifid-cyl-size.patch | 0 ...tential-NULL-dereference-in-ped_disk.patch | 30 +++++++++++++++++++ parted.spec | 9 ++++-- 3 files changed, 36 insertions(+), 3 deletions(-) rename 9000-parted-remove-patch-which-modifid-cyl-size.patch => 0010-parted-remove-patch-which-modifid-cyl-size.patch (100%) create mode 100644 0011-libparted-Fix-potential-NULL-dereference-in-ped_disk.patch diff --git a/9000-parted-remove-patch-which-modifid-cyl-size.patch b/0010-parted-remove-patch-which-modifid-cyl-size.patch similarity index 100% rename from 9000-parted-remove-patch-which-modifid-cyl-size.patch rename to 0010-parted-remove-patch-which-modifid-cyl-size.patch diff --git a/0011-libparted-Fix-potential-NULL-dereference-in-ped_disk.patch b/0011-libparted-Fix-potential-NULL-dereference-in-ped_disk.patch new file mode 100644 index 0000000..7fde5a8 --- /dev/null +++ b/0011-libparted-Fix-potential-NULL-dereference-in-ped_disk.patch @@ -0,0 +1,30 @@ +From 31db44c74a96f8e2b495205d18525449e9b29543 Mon Sep 17 00:00:00 2001 +From: "Brian C. Lane" +Date: Wed, 15 Feb 2023 10:13:58 -0800 +Subject: [PATCH 19/24] libparted: Fix potential NULL dereference in + ped_disk_next_partition + +--- + libparted/disk.c | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +diff --git a/libparted/disk.c b/libparted/disk.c +index 345b9e7..8eba2c2 100644 +--- a/libparted/disk.c ++++ b/libparted/disk.c +@@ -1552,8 +1552,11 @@ ped_disk_next_partition (const PedDisk* disk, const PedPartition* part) + return part->part_list ? part->part_list : part->next; + if (part->next) + return part->next; +- if (part->type & PED_PARTITION_LOGICAL) ++ if (part->type & PED_PARTITION_LOGICAL) { ++ if (!ped_disk_extended_partition (disk)) ++ return NULL; + return ped_disk_extended_partition (disk)->next; ++ } + return NULL; + } + +-- +2.33.0 + diff --git a/parted.spec b/parted.spec index be7e843..31b2094 100644 --- a/parted.spec +++ b/parted.spec @@ -16,7 +16,7 @@ Summary: The GNU disk partition manipulation program Name: parted Version: 3.5 -Release: 2 +Release: 3 URL: https://www.gnu.org/software/parted/ Source0: ftp://ftp.gnu.org/gnu/%{name}/%{name}-%{version}.tar.xz License: GPLv3+ @@ -35,8 +35,8 @@ Patch6: 0006-scsi_get_product_info-fix-memleak-and-avoid-to-use-N.patch Patch7: 0007-fat_op_context_new-free-ctx-remap-and-goto-correct-l.patch Patch8: 0008-hfsplus_cache_from_extent-fix-memleak.patch Patch9: 0009-fat_clobber-set-boot_sector-NULL-and-free-boot_secto.patch - -Patch9000: 9000-parted-remove-patch-which-modifid-cyl-size.patch +Patch10:0010-parted-remove-patch-which-modifid-cyl-size.patch +Patch11:0011-libparted-Fix-potential-NULL-dereference-in-ped_disk.patch %description The GNU Parted program allows you to create, destroy, resize, move, @@ -121,6 +121,9 @@ fi %{_libdir}/pkgconfig/libparted*.pc %changelog +* Sun Apr 7 2024 volcanodragon - 3.5-3 +- libparted: Fix potential NULL dereference in ped_disk_next_partition + * Thu Dec 14 2023 lingsheng - 3.5-2 - remove patch which modifid cyl-size -- Gitee