1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-06-23 21:45:30 +00:00

Fix a segfault when uploading or downloading files

The variable `ccount->tls_policy` was not null-tested before `strcmp`.
This commit is contained in:
Maxi Wuttke 2022-04-01 21:07:43 +02:00 committed by Michael Vetter
parent cef0c5e927
commit f11ad16714
2 changed files with 2 additions and 2 deletions

View File

@ -128,7 +128,7 @@ http_file_get(void* userdata)
char* cert_path = prefs_get_string(PREF_TLS_CERTPATH);
gchar* cafile = cafile_get_name();
ProfAccount* account = accounts_get_account(session_get_account_name());
gboolean insecure = strcmp(account->tls_policy, "trust") == 0;
gboolean insecure = account->tls_policy && strcmp(account->tls_policy, "trust") == 0;
account_free(account);
pthread_mutex_unlock(&lock);

View File

@ -187,7 +187,7 @@ http_file_put(void* userdata)
char* cert_path = prefs_get_string(PREF_TLS_CERTPATH);
gchar* cafile = cafile_get_name();
ProfAccount* account = accounts_get_account(session_get_account_name());
gboolean insecure = strcmp(account->tls_policy, "trust") == 0;
gboolean insecure = account->tls_policy && strcmp(account->tls_policy, "trust") == 0;
account_free(account);
pthread_mutex_unlock(&lock);