From af43ad89650f70ce5e2fb4a45287aabbdd9b63d6 Mon Sep 17 00:00:00 2001 From: Gautier Pelloux-Prayer Date: Tue, 25 Aug 2015 10:11:34 +0200 Subject: [PATCH] proxy.c: fix crash in linphone_core_interpret_url when username is NULL and do not copy parameters when using proxy's domain --- coreapi/linphonecore.c | 15 --------------- coreapi/linphonecore.h | 29 ++++++++++++++++++++++------- coreapi/proxy.c | 5 +++-- 3 files changed, 25 insertions(+), 24 deletions(-) diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index 618322a2b..199187550 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -2925,21 +2925,6 @@ void linphone_configure_op(LinphoneCore *lc, SalOp *op, const LinphoneAddress *d sal_op_cnx_ip_to_0000_if_sendonly_enable(op,lp_config_get_default_int(lc->config,"sip","cnx_ip_to_0000_if_sendonly_enabled",0)); /*also set in linphone_call_new_incoming*/ } -/** - * Initiates an outgoing call given a destination LinphoneAddress - * - * @ingroup call_control - * @param lc the LinphoneCore object - * @param addr the destination of the call (sip address). - @param params call parameters - * - * The LinphoneAddress can be constructed directly using linphone_address_new(), or - * created by linphone_core_interpret_url(). - * The application doesn't own a reference to the returned LinphoneCall object. - * Use linphone_call_ref() to safely keep the LinphoneCall pointer valid within your application. - * - * @return a LinphoneCall object or NULL in case of failure -**/ LinphoneCall * linphone_core_invite_address_with_params(LinphoneCore *lc, const LinphoneAddress *addr, const LinphoneCallParams *params) { const char *from=NULL; diff --git a/coreapi/linphonecore.h b/coreapi/linphonecore.h index 141fc9b5d..baf23442f 100644 --- a/coreapi/linphonecore.h +++ b/coreapi/linphonecore.h @@ -723,7 +723,7 @@ LINPHONE_PUBLIC const char *linphone_call_get_remote_contact(LinphoneCall *call) /** * Get the mesured playback volume level. - * + * * @param call The call. * @return float Volume level in percentage. */ @@ -731,7 +731,7 @@ LINPHONE_PUBLIC float linphone_call_get_play_volume(LinphoneCall *call); /** * Get the mesured record volume level - * + * * @param call The call. * @return float Volume level in percentage. */ @@ -741,7 +741,7 @@ LINPHONE_PUBLIC float linphone_call_get_record_volume(LinphoneCall *call); * Get speaker volume gain. * If the sound backend supports it, the returned gain is equal to the gain set * with the system mixer. - * + * * @param call The call. * @return Percenatge of the max supported volume gain. Valid values are in [ 0.0 : 1.0 ]. * In case of failure, a negative value is returned @@ -751,7 +751,7 @@ LINPHONE_PUBLIC float linphone_call_get_speaker_volume_gain(const LinphoneCall * /** * Set speaker volume gain. * If the sound backend supports it, the new gain will synchronized with the system mixer. - * + * * @param call The call. * @param volume Percentage of the max supported gain. Valid values are in [ 0.0 : 1.0 ]. */ @@ -761,7 +761,7 @@ LINPHONE_PUBLIC void linphone_call_set_speaker_volume_gain(LinphoneCall *call, f * Get microphone volume gain. * If the sound backend supports it, the returned gain is equal to the gain set * with the system mixer. - * + * * @param call The call. * @return double Percenatge of the max supported volume gain. Valid values are in [ 0.0 : 1.0 ]. * In case of failure, a negative value is returned @@ -771,7 +771,7 @@ LINPHONE_PUBLIC float linphone_call_get_microphone_volume_gain(const LinphoneCal /** * Set microphone volume gain. * If the sound backend supports it, the new gain will synchronized with the system mixer. - * + * * @param call The call. * @param volume Percentage of the max supported gain. Valid values are in [ 0.0 : 1.0 ]. */ @@ -896,7 +896,7 @@ typedef enum _LinphoneAudioRoute LinphoneAudioRoute; * Change the playback output device (currently only used for blackberry) * @param call * @param route the wanted audio route (earpiece, speaker, ...) - * + * * @ingroup call_control **/ LINPHONE_PUBLIC void linphone_call_set_audio_route(LinphoneCall *call, LinphoneAudioRoute route); @@ -2319,6 +2319,21 @@ LINPHONE_PUBLIC LinphoneCall * linphone_core_invite_address(LinphoneCore *lc, co LINPHONE_PUBLIC LinphoneCall * linphone_core_invite_with_params(LinphoneCore *lc, const char *url, const LinphoneCallParams *params); +/** + * Initiates an outgoing call given a destination LinphoneAddress + * + * @ingroup call_control + * @param lc the LinphoneCore object + * @param addr the destination of the call (sip address). + @param params call parameters + * + * The LinphoneAddress can be constructed directly using linphone_address_new(), or + * created by linphone_core_interpret_url(). + * The application doesn't own a reference to the returned LinphoneCall object. + * Use linphone_call_ref() to safely keep the LinphoneCall pointer valid within your application. + * + * @return a LinphoneCall object or NULL in case of failure +**/ LINPHONE_PUBLIC LinphoneCall * linphone_core_invite_address_with_params(LinphoneCore *lc, const LinphoneAddress *addr, const LinphoneCallParams *params); LINPHONE_PUBLIC int linphone_core_transfer_call(LinphoneCore *lc, LinphoneCall *call, const char *refer_to); diff --git a/coreapi/proxy.c b/coreapi/proxy.c index 40ef6a0b0..5378236a1 100644 --- a/coreapi/proxy.c +++ b/coreapi/proxy.c @@ -1003,7 +1003,7 @@ LinphoneAddress* linphone_proxy_config_normalize_sip_uri(LinphoneProxyConfig *pr char *tmpurl; LinphoneAddress *uri; - if (*username=='\0') return NULL; + if (!username || *username=='\0') return NULL; if (is_enum(username,&enum_domain)){ if (proxy) { @@ -1036,8 +1036,9 @@ LinphoneAddress* linphone_proxy_config_normalize_sip_uri(LinphoneProxyConfig *pr } if (proxy!=NULL){ - /* append the proxy domain suffix */ + /* append the proxy domain suffix but remove any custom parameters/headers */ LinphoneAddress *uri=linphone_address_clone(linphone_proxy_config_get_identity_address(proxy)); + linphone_address_clean(uri); if (uri==NULL){ return NULL; } else {