Commit 26c21451 authored by Ghislain MARY's avatar Ghislain MARY
Browse files

Secure code and fix memory leak.

parent 5b8cb646
......@@ -422,11 +422,17 @@ static void linphone_gtk_assistant_prepare(GtkWidget *assistant, GtkWidget *page
gchar *username = creator->username + 4;
const gchar *needle = "@";
username = g_strndup(username, (g_strrstr(username, needle) - username));
const gchar *needle_ptr = g_strrstr(username, needle);
if (needle_ptr != NULL) {
username = g_strndup(username, needle_ptr - username);
} else {
username = g_strdup(username);
}
gchar domain[128];
g_snprintf(domain, sizeof(domain), "\"%s\"", creator->domain + 4);
LinphoneAuthInfo *info=linphone_auth_info_new(username, username, creator->password, NULL, domain);
linphone_core_add_auth_info(linphone_gtk_get_core(),info);
g_free(username);
if (linphone_core_add_proxy_config(linphone_gtk_get_core(),cfg)==-1)
return;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment