[gnome-control-center] wifi: Don't access potentially invalid pointer
- From: Georges Basile Stavracas Neto <gbsneto src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-control-center] wifi: Don't access potentially invalid pointer
- Date: Sat, 12 Aug 2017 22:04:06 +0000 (UTC)
commit fcf4e44ebddc1a8792f385cc6acfd5556d782375
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date: Sat Aug 12 18:58:10 2017 -0300
wifi: Don't access potentially invalid pointer
When the user launches Settings with a panel passed
as argument, the following things happen:
1. The Wi-Fi panel starts loading.
2. The command line arguments are passed and the given
panel is activated.
3. The Wi-Fi panel cancels the loading routine, and
rfkill_proxy_acquired_cb() is called with the GError
set as G_IO_ERROR_CANCELLED.
4. Crash in rfkill_proxy_acquired_cb().
The crash is caused because, when rfkill_proxy_acquired_cb()
is called, the CcWifiPanel instance isn't valid anymore. And
yet, the code tries to cast 'gpointer user_data' to a
CcWifiPanel pointer.
Fix that by only trying to cast anything after parsing the
GError set by the callback.
panels/network/cc-wifi-panel.c | 12 +++++++++---
1 files changed, 9 insertions(+), 3 deletions(-)
---
diff --git a/panels/network/cc-wifi-panel.c b/panels/network/cc-wifi-panel.c
index f499938..18ba1ba 100644
--- a/panels/network/cc-wifi-panel.c
+++ b/panels/network/cc-wifi-panel.c
@@ -404,10 +404,12 @@ rfkill_proxy_acquired_cb (GObject *source_object,
GAsyncResult *res,
gpointer user_data)
{
- CcWifiPanel *self = CC_WIFI_PANEL (user_data);
- GError *error = NULL;
+ CcWifiPanel *self;
+ GDBusProxy *proxy;
+ GError *error;
- self->rfkill_proxy = g_dbus_proxy_new_for_bus_finish (res, &error);
+ error = NULL;
+ proxy = g_dbus_proxy_new_for_bus_finish (res, &error);
if (error)
{
@@ -418,6 +420,10 @@ rfkill_proxy_acquired_cb (GObject *source_object,
return;
}
+ self = CC_WIFI_PANEL (user_data);
+
+ self->rfkill_proxy = proxy;
+
sync_airplane_mode_switch (self);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]