parted/0019-libparted-Fix-potential-NULL-dereference-in-ped_disk.patch
Brian C. Lane d747d1a8fe - parted: Fix ending sector location when using kibi IEC suffix (bcl)
- tests: Fix formatting and snprintf warnings in tests. (bcl)
- ui: Add checks for prompt being NULL (bcl)
- strlist: Handle realloc error in wchar_to_str (bcl)
- libparted: Fix potential NULL dereference in ped_disk_next_partition (bcl)
- filesys: Check for null from close_fn (bcl)
2023-03-20 09:51:40 -07:00

31 lines
876 B
Diff

From 31db44c74a96f8e2b495205d18525449e9b29543 Mon Sep 17 00:00:00 2001
From: "Brian C. Lane" <bcl@redhat.com>
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 e1a3489..6c82877 100644
--- a/libparted/disk.c
+++ b/libparted/disk.c
@@ -1718,8 +1718,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.39.2