[parted-devel] [PATCH v2] dasd: avoid usage of uninitialized data
Brian C. Lane
bcl at redhat.com
Wed Apr 23 00:19:26 UTC 2014
On Thu, Mar 27, 2014 at 08:31:42AM +0100, Petr Uzel wrote:
> 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/dasd.c (dasd_partition_new):
> Zero out allocated disk_specific data.
> ---
> libparted/labels/dasd.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/libparted/labels/dasd.c b/libparted/labels/dasd.c
> index a769866..c007427 100644
> --- a/libparted/labels/dasd.c
> +++ b/libparted/labels/dasd.c
> @@ -658,7 +658,7 @@ dasd_partition_new (const PedDisk* disk, PedPartitionType part_type,
> if (!part)
> goto error;
>
> - part->disk_specific = ped_malloc (sizeof (DasdPartitionData));
> + part->disk_specific = ped_calloc (sizeof (DasdPartitionData));
> return part;
>
> error:
> --
> 1.8.4.5
Ack.
--
Brian C. Lane | Anaconda Team | IRC: bcl #anaconda | Port Orchard, WA (PST8PDT)
More information about the parted-devel
mailing list