Secure code and fix memory leak.

This commit is contained in:
Ghislain MARY 2013-07-02 13:18:57 +02:00
parent 5b8cb64650
commit 26c21451b9

View file

@ -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;