diff options
author | Jiří Klimeš <jklimes@redhat.com> | 2015-11-16 11:00:42 +0100 |
---|---|---|
committer | Jiří Klimeš <jklimes@redhat.com> | 2015-11-18 09:15:39 +0100 |
commit | f902444325944f324e8c9b37d6d00f2603b52547 (patch) | |
tree | b9db1229539cadee67a52789355082d58708271a | |
parent | 914d875dc2ea2e410c422cf9d027d33e47396cdf (diff) | |
download | NetworkManager-f902444325944f324e8c9b37d6d00f2603b52547.tar.gz |
ifcfg: fix a possible double-free error on invalid WEP key (rh #1281324)
https://bugzilla.redhat.com/show_bug.cgi?id=1281324
-rw-r--r-- | src/settings/plugins/ifcfg-rh/writer.c | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/src/settings/plugins/ifcfg-rh/writer.c b/src/settings/plugins/ifcfg-rh/writer.c index ca45721934..aaf0ebe906 100644 --- a/src/settings/plugins/ifcfg-rh/writer.c +++ b/src/settings/plugins/ifcfg-rh/writer.c @@ -713,15 +713,19 @@ write_wireless_security_setting (NMConnection *connection, ascii_key = g_strdup_printf ("s:%s", key); key = ascii_key; } - } else - key = NULL; - - set_secret (ifcfg, - tmp, - key, - "WEP_KEY_FLAGS", - nm_setting_wireless_security_get_wep_key_flags (s_wsec), - FALSE); + } else { + nm_log_warn (LOGD_SETTINGS, " invalid WEP key '%s'", key); + tmp = NULL; + } + + if (tmp) { + set_secret (ifcfg, + tmp, + key, + "WEP_KEY_FLAGS", + nm_setting_wireless_security_get_wep_key_flags (s_wsec), + FALSE); + } g_free (tmp); g_free (ascii_key); } |