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 <[email protected]>
---
 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


_______________________________________________
parted-devel mailing list
[email protected]
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/parted-devel

Reply via email to