[PATCH] don't segfault on a device-mapper device with no target
Jim Meyering
meyering at redhat.com
Fri Feb 13 11:08:13 UTC 2009
* libparted/arch/linux.c (_dm_maptype): Don't dereference NULL
for a device-mapper device with no target. Use the string
"NO-TARGET" instead. Reported by Mike Hwang in
http://thread.gmane.org/gmane.comp.gnu.parted.devel/2432
---
libparted/arch/linux.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/libparted/arch/linux.c b/libparted/arch/linux.c
index da812d5..4a8c9e7 100644
--- a/libparted/arch/linux.c
+++ b/libparted/arch/linux.c
@@ -348,7 +348,7 @@ _dm_maptype (PedDevice *dev)
next = dm_get_next_target(dmt, NULL, &start, &length,
&target_type, ¶ms);
- arch_specific->dmtype = strdup(target_type);
+ arch_specific->dmtype = strdup(target_type ? target_type : "NO-TARGET");
if (arch_specific->dmtype == NULL)
goto bad;
r = 0;
--
1.6.2.rc0.226.gf08f
More information about the parted-devel
mailing list