fix potential crash when DONTBIND transports are configured.

This commit is contained in:
Simon Morlat 2016-11-10 11:32:52 +01:00
parent 053a368d60
commit a961d2771b
2 changed files with 5 additions and 1 deletions

View file

@ -1901,6 +1901,7 @@ int linphone_core_set_primary_contact(LinphoneCore *lc, const char *contact)
static void update_primary_contact(LinphoneCore *lc){
char *guessed=NULL;
char tmp[LINPHONE_IPADDR_SIZE];
int port;
LinphoneAddress *url;
if (lc->sip_conf.guessed_contact!=NULL){
@ -1918,7 +1919,9 @@ static void update_primary_contact(LinphoneCore *lc){
lc->sip_conf.loopback_only=TRUE;
}else lc->sip_conf.loopback_only=FALSE;
linphone_address_set_domain(url,tmp);
linphone_address_set_port(url,linphone_core_get_sip_port(lc));
port = linphone_core_get_sip_port(lc);
if (port > 0) linphone_address_set_port(url, port); /*if there is no listening socket the primary contact is somewhat useless,
it won't work. But we prefer to return something in all cases. It at least shows username and ip address.*/
guessed=linphone_address_as_string(url);
lc->sip_conf.guessed_contact=guessed;
linphone_address_destroy(url);

View file

@ -215,6 +215,7 @@ static const char *linphone_gtk_get_factory_config_file(void){
}
}
if (path) {
ms_message("Factory config file expected at %s", path);
//use factory file only if it exists
if (bctbx_file_exist(path)==0){
snprintf(_factory_config_file, sizeof(_factory_config_file), "%s", path);