[Pkg-libvirt-commits] [libguestfs] 18/35: daemon: parted: Don't crash if part-get-name called on non-partitioned device (RHBZ#1142158).
Hilko Bengen
bengen at moszumanska.debian.org
Fri Oct 3 14:46:42 UTC 2014
This is an automated email from the git hooks/post-receive script.
bengen pushed a commit to annotated tag debian/1%1.27.49-1
in repository libguestfs.
commit 5fcc584c344e7894e2da15071050b6eb5f882f55
Author: Richard W.M. Jones <rjones at redhat.com>
Date: Wed Sep 17 15:34:03 2014 +0100
daemon: parted: Don't crash if part-get-name called on non-partitioned device (RHBZ#1142158).
If do_part_get_parttype returns NULL, then return from the function
instead of dereferencing the NULL pointer and crashing. Note that
do_part_get_parttype has already called reply_with_error in this case.
This fixes commit 0316d247706aab7ce7c2225472feeb51fa8b1664.
Found by: Lingfei Kong
---
daemon/parted.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/daemon/parted.c b/daemon/parted.c
index 5b049f5..5e016f4 100644
--- a/daemon/parted.c
+++ b/daemon/parted.c
@@ -896,7 +896,11 @@ do_part_get_gpt_type (const char *device, int partnum)
char *
do_part_get_name (const char *device, int partnum)
{
- CLEANUP_FREE char *parttype = do_part_get_parttype (device);
+ CLEANUP_FREE char *parttype;
+
+ parttype = do_part_get_parttype (device);
+ if (parttype == NULL)
+ return NULL;
if (STREQ (parttype, "gpt")) {
int parted_has_m_opt = test_parted_m_opt ();
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-libvirt/libguestfs.git
More information about the Pkg-libvirt-commits
mailing list