[parted-devel] [PATCH] dasd: avoid usage of uninitialized data
Petr Uzel
petr.uzel at suse.cz
Thu Mar 20 15:33:42 UTC 2014
In ped_partition_new(), disk_specific data of PedPartition
structure is allocated (via dasd_partition_new()). This
data is later used uninitialized in dasd_partition_set_system().
* libparted/labels/vtoc.c (dasd_partition_new):
Zero out allocated disk_specific data.
---
libparted/labels/dasd.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/libparted/labels/dasd.c b/libparted/labels/dasd.c
index a769866..f5b0f2b 100644
--- a/libparted/labels/dasd.c
+++ b/libparted/labels/dasd.c
@@ -659,6 +659,8 @@ dasd_partition_new (const PedDisk* disk, PedPartitionType part_type,
goto error;
part->disk_specific = ped_malloc (sizeof (DasdPartitionData));
+ if (part->disk_specific)
+ memset(part->disk_specific, 0, sizeof(DasdPartitionData));
return part;
error:
--
1.8.1.4
More information about the parted-devel
mailing list