neil / rpms / udisks2

Forked from rpms/udisks2 a year ago
Clone

Blame SOURCES/udisks-2.1.3-udisksctl-loop-delete-crash.patch

5137f5
From 4d867ff2a454a155828a2616cd674b1a8d018260 Mon Sep 17 00:00:00 2001
5137f5
From: Tomas Bzatek <tbzatek@redhat.com>
5137f5
Date: Tue, 14 Jan 2014 17:20:19 +0000
5137f5
Subject: Fix crash when loop-deleting non-loop device
5137f5
5137f5
When a non-loop device file is specified, a lookup succeeds but it's not
5137f5
a UDisks2.Loop object. This change prevents a crash when null pointer is
5137f5
passed further in the calls.
5137f5
5137f5
https://bugzilla.redhat.com/show_bug.cgi?id=1036076
5137f5
5137f5
Signed-off-by: David Zeuthen <zeuthen@gmail.com>
5137f5
---
5137f5
diff --git a/tools/udisksctl.c b/tools/udisksctl.c
5137f5
index 97b0f17..209c0a3 100644
5137f5
--- a/tools/udisksctl.c
5137f5
+++ b/tools/udisksctl.c
5137f5
@@ -1691,6 +1691,12 @@ handle_command_loop (gint        *argc,
5137f5
           goto out;
5137f5
         }
5137f5
 
5137f5
+      if (udisks_object_peek_loop (object) == NULL)
5137f5
+        {
5137f5
+          g_printerr ("Error: specified object is not a loop device\n");
5137f5
+          goto out;
5137f5
+        }
5137f5
+
5137f5
     delete_try_again:
5137f5
       error = NULL;
5137f5
       if (!udisks_loop_call_delete_sync (udisks_object_peek_loop (object),
5137f5
--
5137f5
cgit v0.9.0.2-2-gbebe