[parted-devel] [PATCH 4/8] libparted: check return value from ped_geometry_init
Petr Uzel
petr.uzel at suse.cz
Wed Sep 28 08:45:05 UTC 2011
If ped_geometry_init() failed in ped_disk_set_partition_geom(),
then new_geom remains uninitialized, but still later used, which
leads to unexpected results.
* libparted/disk.c (ped_disk_set_partition_geom): Check return
value from ped_geometry_init().
Signed-off-by: Petr Uzel <petr.uzel at suse.cz>
---
libparted/disk.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/libparted/disk.c b/libparted/disk.c
index 1057aa8..807b53a 100644
--- a/libparted/disk.c
+++ b/libparted/disk.c
@@ -2171,7 +2171,8 @@ ped_disk_set_partition_geom (PedDisk* disk, PedPartition* part,
PED_ASSERT (part->disk == disk);
old_geom = part->geom;
- ped_geometry_init (&new_geom, part->geom.dev, start, end - start + 1);
+ if (!ped_geometry_init (&new_geom, part->geom.dev, start, end - start + 1))
+ return 0;
if (!_disk_push_update_mode (disk))
return 0;
--
1.7.3.4
More information about the parted-devel
mailing list