Fix dangling pointer in proxy password handling.
authorAndrej Kacian <ticho@claws-mail.org>
Thu, 6 Sep 2018 21:31:16 +0000 (23:31 +0200)
committerAndrej Kacian <ticho@claws-mail.org>
Thu, 6 Sep 2018 21:31:16 +0000 (23:31 +0200)
Initialize proxy_info.proxy_pass to NULL, and reset it
back to NULL after use.

src/common/proxy.c
src/prefs_account.c
src/prefs_common.c

index 7a30030..bffeb41 100644 (file)
@@ -61,6 +61,7 @@ gint proxy_connect(SockInfo *sock, const gchar *hostname, gushort port,
                if (proxy_info->proxy_pass != NULL) {
                        memset(proxy_info->proxy_pass, 0, strlen(proxy_info->proxy_pass));
                        g_free(proxy_info->proxy_pass);
+                       proxy_info->proxy_pass = NULL;
                }
                return ret;
        } else if (proxy_info->proxy_type == PROXY_SOCKS4) {
index 9491d58..efac2ce 100644 (file)
@@ -874,7 +874,7 @@ static PrefParam proxy_param[] = {
        &proxy_page.proxy_name_entry,
        prefs_set_data_from_entry, prefs_set_entry},
 
-       {"proxy_pass", "", &tmp_ac_prefs.proxy_info.proxy_pass, P_PASSWORD,
+       {"proxy_pass", NULL, &tmp_ac_prefs.proxy_info.proxy_pass, P_PASSWORD,
        NULL, NULL, NULL},
 
 
index c7dc37c..b479e0f 100644 (file)
@@ -1262,7 +1262,7 @@ static PrefParam param[] = {
        {"proxy_port", "1080", &prefs_common.proxy_info.proxy_port, P_USHORT, NULL, NULL, NULL},
        {"use_proxy_auth", "FALSE", &prefs_common.proxy_info.use_proxy_auth, P_BOOL, NULL, NULL, NULL},
        {"proxy_name", "", &prefs_common.proxy_info.proxy_name, P_STRING, NULL, NULL, NULL},
-       {"proxy_pass", "", &prefs_common.proxy_info.proxy_pass, P_STRING, NULL, NULL, NULL},
+       {"proxy_pass", NULL, &prefs_common.proxy_info.proxy_pass, P_STRING, NULL, NULL, NULL},
 
        {NULL, NULL, NULL, P_OTHER, NULL, NULL, NULL}
 };