[gnome-control-center] network: Fix crash when changing IPv4 DNS
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-control-center] network: Fix crash when changing IPv4 DNS
- Date: Tue, 13 Sep 2016 09:47:32 +0000 (UTC)
commit ca47ff295a1e45598068201633aa2bd0d8fd5b29
Author: Bastien Nocera <hadess hadess net>
Date: Tue Sep 13 11:45:20 2016 +0200
network: Fix crash when changing IPv4 DNS
The dns_servers GStrv was not NULL-terminated because we forgot to
append a NULL item to the GPtrArray that we used to construct it.
https://bugzilla.gnome.org/show_bug.cgi?id=771251
panels/network/connection-editor/ce-page-ip4.c | 9 ++++++++-
1 files changed, 8 insertions(+), 1 deletions(-)
---
diff --git a/panels/network/connection-editor/ce-page-ip4.c b/panels/network/connection-editor/ce-page-ip4.c
index 2645603..bcc7e0b 100644
--- a/panels/network/connection-editor/ce-page-ip4.c
+++ b/panels/network/connection-editor/ce-page-ip4.c
@@ -787,6 +787,13 @@ ui_to_setting (CEPageIP4 *page)
}
g_list_free (children);
+ if (dns_servers->len == 0) {
+ g_ptr_array_free (dns_servers, TRUE);
+ dns_servers = NULL;
+ } else {
+ g_ptr_array_add (dns_servers, NULL);
+ }
+
routes = g_ptr_array_new_with_free_func (g_object_unref);
if (g_str_equal (method, NM_SETTING_IP4_CONFIG_METHOD_AUTO) ||
g_str_equal (method, NM_SETTING_IP4_CONFIG_METHOD_MANUAL))
@@ -878,7 +885,7 @@ ui_to_setting (CEPageIP4 *page)
g_object_set (page->setting,
NM_SETTING_IP_CONFIG_METHOD, method,
NM_SETTING_IP_CONFIG_ADDRESSES, addresses,
- NM_SETTING_IP_CONFIG_DNS, dns_servers->pdata,
+ NM_SETTING_IP_CONFIG_DNS, dns_servers ? dns_servers->pdata : NULL,
NM_SETTING_IP_CONFIG_ROUTES, routes,
NM_SETTING_IP_CONFIG_IGNORE_AUTO_DNS, ignore_auto_dns,
NM_SETTING_IP_CONFIG_IGNORE_AUTO_ROUTES, ignore_auto_routes,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]