[gnome-control-center/gnome-3-8] network: Fix a possible crash with no active connections
- From: Kalev Lember <klember src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-control-center/gnome-3-8] network: Fix a possible crash with no active connections
- Date: Wed, 11 Sep 2013 14:40:24 +0000 (UTC)
commit d6a9d12d4b9be76fc27ee53a7e13e3ccee37a6fd
Author: Kalev Lember <kalevlember gmail com>
Date: Wed Sep 11 16:12:49 2013 +0200
network: Fix a possible crash with no active connections
As a precaution, check the return value of get_active_connections to
avoid dereferencing a NULL pointer.
https://bugzilla.redhat.com/show_bug.cgi?id=990196
https://bugzilla.gnome.org/show_bug.cgi?id=707906
panels/network/net-device-mobile.c | 2 +-
panels/network/net-device-simple.c | 2 +-
panels/network/net-device-wifi.c | 2 +-
panels/network/net-vpn.c | 2 +-
4 files changed, 4 insertions(+), 4 deletions(-)
---
diff --git a/panels/network/net-device-mobile.c b/panels/network/net-device-mobile.c
index c7c4bb9..012cb72 100644
--- a/panels/network/net-device-mobile.c
+++ b/panels/network/net-device-mobile.c
@@ -479,7 +479,7 @@ device_off_toggled (GtkSwitch *sw,
path = nm_connection_get_path (connection);
client = net_object_get_client (NET_OBJECT (device_mobile));
acs = nm_client_get_active_connections (client);
- for (i = 0; i < acs->len; i++) {
+ for (i = 0; acs && i < acs->len; i++) {
a = (NMActiveConnection*)acs->pdata[i];
if (strcmp (nm_active_connection_get_connection (a), path) == 0) {
nm_client_deactivate_connection (client, a);
diff --git a/panels/network/net-device-simple.c b/panels/network/net-device-simple.c
index 0b936ed..4be2fca 100644
--- a/panels/network/net-device-simple.c
+++ b/panels/network/net-device-simple.c
@@ -178,7 +178,7 @@ device_off_toggled (GtkSwitch *sw,
path = nm_connection_get_path (connection);
client = net_object_get_client (NET_OBJECT (device_simple));
acs = nm_client_get_active_connections (client);
- for (i = 0; i < acs->len; i++) {
+ for (i = 0; acs && i < acs->len; i++) {
a = (NMActiveConnection*)acs->pdata[i];
if (strcmp (nm_active_connection_get_connection (a), path) == 0) {
nm_client_deactivate_connection (client, a);
diff --git a/panels/network/net-device-wifi.c b/panels/network/net-device-wifi.c
index c5ddeb9..420bb07 100644
--- a/panels/network/net-device-wifi.c
+++ b/panels/network/net-device-wifi.c
@@ -1150,7 +1150,7 @@ stop_shared_connection (NetDeviceWifi *device_wifi)
device = net_device_get_nm_device (NET_DEVICE (device_wifi));
client = net_object_get_client (NET_OBJECT (device_wifi));
connections = nm_client_get_active_connections (client);
- for (i = 0; i < connections->len; i++) {
+ for (i = 0; connections && i < connections->len; i++) {
c = (NMActiveConnection *)connections->pdata[i];
devices = nm_active_connection_get_devices (c);
diff --git a/panels/network/net-vpn.c b/panels/network/net-vpn.c
index 9125aa6..35c0f22 100644
--- a/panels/network/net-vpn.c
+++ b/panels/network/net-vpn.c
@@ -390,7 +390,7 @@ device_off_toggled (GtkSwitch *sw,
path = nm_connection_get_path (vpn->priv->connection);
client = net_object_get_client (NET_OBJECT (vpn));
acs = nm_client_get_active_connections (client);
- for (i = 0; i < acs->len; i++) {
+ for (i = 0; acs && i < acs->len; i++) {
a = (NMActiveConnection*)acs->pdata[i];
if (strcmp (nm_active_connection_get_connection (a), path) == 0) {
nm_client_deactivate_connection (client, a);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]