From b322931ea69583140b512803ccdc75f0a1671cc1 Mon Sep 17 00:00:00 2001 From: Lubomir Rintel Date: Tue, 20 Jun 2017 17:19:04 +0200 Subject: [PATCH 2/2] wireless-security: fix some crash issues on connection save A use-after-free and a double-free. --- src/wireless-security/eap-method-tls.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/wireless-security/eap-method-tls.c b/src/wireless-security/eap-method-tls.c index 0595fd06..d3bbf66d 100644 --- a/src/wireless-security/eap-method-tls.c +++ b/src/wireless-security/eap-method-tls.c @@ -143,7 +143,7 @@ fill_connection (EAPMethod *parent, NMConnection *connection) #endif /* TLS private key */ - password = g_strdup (nma_cert_chooser_get_key_password (NMA_CERT_CHOOSER (method->client_cert_chooser))); + password = nma_cert_chooser_get_key_password (NMA_CERT_CHOOSER (method->client_cert_chooser)); value = nma_cert_chooser_get_key (NMA_CERT_CHOOSER (method->client_cert_chooser), &scheme); if (parent->phase2) { @@ -157,6 +157,7 @@ fill_connection (EAPMethod *parent, NMConnection *connection) g_clear_error (&error); } } + g_free (value); #if LIBNM_BUILD /* libnm-glib doesn't support these. */ @@ -222,6 +223,8 @@ fill_connection (EAPMethod *parent, NMConnection *connection) /* TLS CA certificate */ if (gtk_widget_get_sensitive (method->ca_cert_chooser)) value = nma_cert_chooser_get_cert (NMA_CERT_CHOOSER (method->ca_cert_chooser), &scheme); + else + value = NULL; format = NM_SETTING_802_1X_CK_FORMAT_UNKNOWN; if (parent->phase2) { if (!nm_setting_802_1x_set_phase2_ca_cert (s_8021x, value, scheme, &format, &error)) { -- 2.13.0