[glib] gio: Handle NULL cached properties in NetworkManager monitor



commit ca0632ca5cceb8cebfbb7a57725577034348f7b7
Author: Philip Withnall <philip tecnocode co uk>
Date:   Sun Dec 7 22:41:57 2014 +0000

    gio: Handle NULL cached properties in NetworkManager monitor
    
    g_dbus_proxy_get_cached_property() and
    g_dbus_proxy_get_cached_property_names() can both return NULL if the
    property cache is empty. Avoid a crash if this situation arises (which
    it looks like it could, from reading the code) by gracefully bailing out
    on NULL return values.
    
    Coverity issues: #1257044, #1257045
    
    https://bugzilla.gnome.org/show_bug.cgi?id=741229

 gio/gnetworkmonitornm.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
---
diff --git a/gio/gnetworkmonitornm.c b/gio/gnetworkmonitornm.c
index afa23f7..5bab65d 100644
--- a/gio/gnetworkmonitornm.c
+++ b/gio/gnetworkmonitornm.c
@@ -161,6 +161,9 @@ sync_properties (GNetworkMonitorNM *nm,
   GNetworkConnectivity new_connectivity;
 
   v = g_dbus_proxy_get_cached_property (nm->priv->proxy, "Connectivity");
+  if (!v)
+    return;
+
   nm_connectivity = g_variant_get_uint32 (v);
   g_variant_unref (v);
 


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