]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
[mod_sofia] scan-build: Dereference of null pointer in sofia_handle_sip_i_bye(),...
authorAndrey Volk <andywolk@gmail.com>
Thu, 1 Apr 2021 21:27:59 +0000 (00:27 +0300)
committerAndrey Volk <andywolk@gmail.com>
Tue, 19 Oct 2021 17:30:15 +0000 (20:30 +0300)
src/mod/endpoints/mod_sofia/sofia.c

index c66f315816c0fede528dc9cfee64ed5145c1fb08..e5ba5ce0466aeec8025fb7b30a07befbc3d64f31 100644 (file)
@@ -960,7 +960,7 @@ void sofia_handle_sip_i_bye(switch_core_session_t *session, int status,
        char st[80] = "";
 #endif
 
-       if (!session) {
+       if (!session || !sip) {
                return;
        }
 
@@ -1615,7 +1615,7 @@ static void our_sofia_event_callback(nua_event_t event,
                        authorization = sip->sip_proxy_authorization;
                }
 
-               if (authorization) {
+               if (authorization && sip->sip_request) {
                        char network_ip[80] = "";
                        int network_port;
                        sofia_glue_get_addr(de->data->e_msg, network_ip, sizeof(network_ip), &network_port);
@@ -10694,8 +10694,9 @@ void sofia_handle_sip_i_invite(switch_core_session_t *session, nua_t *nua, sofia
                }
        }
 
-
-       tech_pvt->from_user = switch_core_session_strdup(session, sip->sip_from->a_url->url_user);
+       if (sip->sip_from && sip->sip_from->a_url) {
+               tech_pvt->from_user = switch_core_session_strdup(session, sip->sip_from->a_url->url_user);
+       }
        tech_pvt->mparams.remote_ip = switch_core_session_strdup(session, network_ip);
        tech_pvt->mparams.remote_port = network_port;
 
@@ -11268,7 +11269,7 @@ void sofia_handle_sip_i_invite(switch_core_session_t *session, nua_t *nua, sofia
 
        if (profile->pres_type) {
                const char *presence_id = switch_channel_get_variable(channel, "presence_id");
-               if (zstr(presence_id)) {
+               if (zstr(presence_id) && sip->sip_from && sip->sip_from->a_url) {
                        const char *user = switch_str_nil(sip->sip_from->a_url->url_user);
                        const char *host = switch_str_nil(sip->sip_from->a_url->url_host);
                        char *tmp = switch_mprintf("%s@%s", user, host);