[glib] GIO: avoid a crash in calling portals



commit 7e4a0d847940a0ad70932da80f5adf72889e66b5
Author: Matthias Clasen <mclasen redhat com>
Date:   Sun Mar 25 00:10:21 2018 -0400

    GIO: avoid a crash in calling portals
    
    When the OpenUri portal call fails, we were possibly
    freeing uninitialized memory. Avoid that by initializing
    path to NULL here.
    
    See https://github.com/flatpak/xdg-desktop-portal/issues/173

 gio/gopenuriportal.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/gio/gopenuriportal.c b/gio/gopenuriportal.c
index 247ed8ce7..38d60bf68 100644
--- a/gio/gopenuriportal.c
+++ b/gio/gopenuriportal.c
@@ -203,7 +203,7 @@ open_call_done (GObject      *source,
   GError *error = NULL;
   gboolean open_file;
   gboolean res;
-  char *path;
+  char *path = NULL;
   const char *handle;
   guint signal_id;
 
@@ -224,7 +224,7 @@ open_call_done (GObject      *source,
     }
 
   handle = (const char *)g_object_get_data (G_OBJECT (task), "handle");
-  if (strcmp (handle, path) != 0)
+  if (g_strcmp0 (handle, path) != 0)
     {
       signal_id = GPOINTER_TO_UINT (g_object_get_data (G_OBJECT (task), "signal-id"));
       g_dbus_connection_signal_unsubscribe (connection, signal_id);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]