diff --git a/libs/sofia-sip/.update b/libs/sofia-sip/.update index 31b25be307..0d656974e6 100644 --- a/libs/sofia-sip/.update +++ b/libs/sofia-sip/.update @@ -1 +1 @@ -Wed Feb 12 22:23:00 UTC 2020 +Thu Feb 13 14:53:01 UTC 2020 diff --git a/libs/sofia-sip/libsofia-sip-ua/msg/msg_parser.c b/libs/sofia-sip/libsofia-sip-ua/msg/msg_parser.c index ca904aea80..2e3a8d42af 100644 --- a/libs/sofia-sip/libsofia-sip-ua/msg/msg_parser.c +++ b/libs/sofia-sip/libsofia-sip-ua/msg/msg_parser.c @@ -1244,7 +1244,7 @@ issize_t msg_parse_next_field(su_home_t *home, msg_header_t *prev, msg_header_t *msg_header_d(su_home_t *home, msg_t const *msg, char const *b) { msg_mclass_t const *mc = msg->m_class; - msg_href_t const *hr = mc->mc_unknown; + msg_href_t const *hr; isize_t n; /* Length of header contents */ isize_t name_len, xtra; msg_header_t *h; diff --git a/libs/sofia-sip/libsofia-sip-ua/msg/msg_parser_util.c b/libs/sofia-sip/libsofia-sip-ua/msg/msg_parser_util.c index b64c4489df..109ee60ff5 100644 --- a/libs/sofia-sip/libsofia-sip-ua/msg/msg_parser_util.c +++ b/libs/sofia-sip/libsofia-sip-ua/msg/msg_parser_util.c @@ -1756,7 +1756,7 @@ issize_t msg_unquoted_e(char *b, isize_t bsiz, char const *s) size_t n = strcspn(s, "\"\\"); if (n == 0) { - if (e + 2 <= bsiz) + if (b && e + 2 <= bsiz) b[e] = '\\', b[e + 1] = s[0]; e += 2; s++; @@ -1769,7 +1769,7 @@ issize_t msg_unquoted_e(char *b, isize_t bsiz, char const *s) } } - if (e < bsiz) + if (b && e < bsiz) b[e] = '"'; e++; diff --git a/libs/sofia-sip/libsofia-sip-ua/nea/nea_server.c b/libs/sofia-sip/libsofia-sip-ua/nea/nea_server.c index 42539cf82d..4f1fce43a1 100644 --- a/libs/sofia-sip/libsofia-sip-ua/nea/nea_server.c +++ b/libs/sofia-sip/libsofia-sip-ua/nea/nea_server.c @@ -844,7 +844,7 @@ int nea_view_update(nea_server_t *nes, nea_view_queue(nes, evv, evq); SU_DEBUG_7(("nea_server_update(%p): %s (%s)\n", (void *)nes, - ev->ev_event->o_type, evv->evv_content_type->c_type)); + ev->ev_event->o_type, (evv->evv_content_type ? evv->evv_content_type->c_type : "N/A"))); return 1; } diff --git a/libs/sofia-sip/libsofia-sip-ua/nta/nta.c b/libs/sofia-sip/libsofia-sip-ua/nta/nta.c index 92c8dda444..70aa8d1e4d 100644 --- a/libs/sofia-sip/libsofia-sip-ua/nta/nta.c +++ b/libs/sofia-sip/libsofia-sip-ua/nta/nta.c @@ -2406,6 +2406,11 @@ int agent_init_via(nta_agent_t *self, tport_t *primaries, int use_maddr) } } + if (!via) { + SU_DEBUG_9(("nta: agent_init_via failed\n" VA_NONE)); + goto error; + } + /* Duplicate the list bind to the transports */ new_via = sip_via_dup(self->sa_home, via); /* Duplicate the complete list shown to the application */ @@ -3346,7 +3351,7 @@ void agent_recv_response(nta_agent_t *agent, return; } - if (sip->sip_cseq->cs_method == sip_method_ack) { + if (sip->sip_cseq && sip->sip_cseq->cs_method == sip_method_ack) { /* Drop response messages to ACK */ agent->sa_stats->as_bad_response++; agent->sa_stats->as_bad_message++; @@ -9160,7 +9165,7 @@ outgoing_remove_fork(nta_outgoing_t *orq) nta_outgoing_t **slot; for (slot = &orq->orq_forking->orq_forks; - *slot; + slot && *slot; slot = &(*slot)->orq_forks) { if (orq == *slot) { *slot = orq->orq_forks; diff --git a/libs/sofia-sip/libsofia-sip-ua/nth/nth_server.c b/libs/sofia-sip/libsofia-sip-ua/nth/nth_server.c index bbc61c46de..5fcb15a5c6 100644 --- a/libs/sofia-sip/libsofia-sip-ua/nth/nth_server.c +++ b/libs/sofia-sip/libsofia-sip-ua/nth/nth_server.c @@ -342,6 +342,13 @@ nth_site_t *nth_site_create(nth_site_t *parent, size_t i, j; path = (char *)url->url_path; + + if (!path) { + SU_DEBUG_3(("nth_site_create(): invalid url\n" VA_NONE)); + errno = EINVAL; + goto error; + } + while (path[0] == '/') path++; @@ -842,10 +849,10 @@ void server_request(server_t *srv, if (subsite) subsite->site_access = now; - else + else if (site) site->site_access = now; - if (subsite && subsite->site_isdir && subpath == site_nodir_match) { + if (site && subsite && subsite->site_isdir && subpath == site_nodir_match) { /* Answer with 301 */ http_location_t loc[1]; http_location_init(loc); diff --git a/libs/sofia-sip/libsofia-sip-ua/nua/nua_notifier.c b/libs/sofia-sip/libsofia-sip-ua/nua/nua_notifier.c index 8ef6747aff..97247f9d6d 100644 --- a/libs/sofia-sip/libsofia-sip-ua/nua/nua_notifier.c +++ b/libs/sofia-sip/libsofia-sip-ua/nua/nua_notifier.c @@ -853,6 +853,9 @@ static int nua_notify_usage_shutdown(nua_handle_t *nh, struct notifier_usage *nu = nua_dialog_usage_private(du); //nua_client_request_t *cr = du->du_cr; + if (!nu) + return -1; + nu->nu_substate = nua_substate_terminated; #if 0 if (cr) { diff --git a/libs/sofia-sip/libsofia-sip-ua/nua/nua_params.c b/libs/sofia-sip/libsofia-sip-ua/nua/nua_params.c index 2d21acbaa2..2140eff7da 100644 --- a/libs/sofia-sip/libsofia-sip-ua/nua/nua_params.c +++ b/libs/sofia-sip/libsofia-sip-ua/nua/nua_params.c @@ -1122,7 +1122,7 @@ int nhp_save_params(nua_handle_t *nh, su_home_t *home = nh->nh_home; nua_t *nua = nh->nh_nua; nua_handle_t *dnh = nua->nua_dhandle; - nua_handle_preferences_t *dst = nh->nh_prefs, old[1]; + nua_handle_preferences_t *dst, old[1]; if (gsrc) { *nua->nua_prefs = *gsrc; /* No pointers this far */ diff --git a/libs/sofia-sip/libsofia-sip-ua/nua/nua_registrar.c b/libs/sofia-sip/libsofia-sip-ua/nua/nua_registrar.c index fbef0166c8..a57b511005 100644 --- a/libs/sofia-sip/libsofia-sip-ua/nua/nua_registrar.c +++ b/libs/sofia-sip/libsofia-sip-ua/nua/nua_registrar.c @@ -86,6 +86,9 @@ static void nua_registrar_usage_remove(nua_handle_t *nh, ru = nua_dialog_usage_private(du); + if (!ru) + return; + if (ru->pending) tport_release(ru->tport, ru->pending, NULL, NULL, nh, 0), ru->pending = 0; diff --git a/libs/sofia-sip/libsofia-sip-ua/nua/nua_session.c b/libs/sofia-sip/libsofia-sip-ua/nua/nua_session.c index d4deed535a..08bc8b6926 100644 --- a/libs/sofia-sip/libsofia-sip-ua/nua/nua_session.c +++ b/libs/sofia-sip/libsofia-sip-ua/nua/nua_session.c @@ -3601,8 +3601,11 @@ int nua_update_server_respond(nua_server_request_t *sr, tagi_t const *tags) sr_status(sr, SIP_500_INTERNAL_SERVER_ERROR); } else { - sr->sr_answer_sent = 1, ss->ss_oa_sent = Answer; - ss->ss_sdp_version = soa_get_user_version(nh->nh_soa); + sr->sr_answer_sent = 1; + if (ss) { + ss->ss_oa_sent = Answer; + ss->ss_sdp_version = soa_get_user_version(nh->nh_soa); + } } } diff --git a/libs/sofia-sip/libsofia-sip-ua/nua/nua_stack.c b/libs/sofia-sip/libsofia-sip-ua/nua/nua_stack.c index cdd3a191ae..696827d91d 100644 --- a/libs/sofia-sip/libsofia-sip-ua/nua/nua_stack.c +++ b/libs/sofia-sip/libsofia-sip-ua/nua/nua_stack.c @@ -667,8 +667,10 @@ void nua_stack_signal(nua_t *nua, su_msg_r msg, nua_ee_data_t *ee) } if (error < 0) { - nua_stack_event(nh->nh_nua, nh, NULL, event, + if (nh) { + nua_stack_event(nh->nh_nua, nh, NULL, event, NUA_ERROR_AT(__FILE__, __LINE__), NULL); + } } su_msg_destroy(nua->nua_signal); diff --git a/libs/sofia-sip/libsofia-sip-ua/sdp/sdp.c b/libs/sofia-sip/libsofia-sip-ua/sdp/sdp.c index 0e248c69df..8ed84ff357 100644 --- a/libs/sofia-sip/libsofia-sip-ua/sdp/sdp.c +++ b/libs/sofia-sip/libsofia-sip-ua/sdp/sdp.c @@ -1370,6 +1370,9 @@ int sdp_key_cmp(sdp_key_t const *a, sdp_key_t const *b) if ((a != NULL) != (b != NULL)) return (a != NULL) < (b != NULL) ? -1 : 1; + if (!a || !b) + return -1; + if (a->k_method != b->k_method) return a->k_method < b->k_method ? -1 : 1; if (a->k_method == sdp_key_x && diff --git a/libs/sofia-sip/libsofia-sip-ua/sip/sip_util.c b/libs/sofia-sip/libsofia-sip-ua/sip/sip_util.c index e5ef095eb0..a581791574 100644 --- a/libs/sofia-sip/libsofia-sip-ua/sip/sip_util.c +++ b/libs/sofia-sip/libsofia-sip-ua/sip/sip_util.c @@ -257,9 +257,11 @@ sip_contact_string_from_via(su_home_t *home, /* Make transport parameter lowercase */ if (transport && strlen(transport) < (sizeof _transport)) { - char *s = strcpy(_transport, transport); + char *s; short c; + strcpy(_transport, transport); + for (s = _transport; (c = *s) && c != ';'; s++) if (isupper(c)) *s = tolower(c); diff --git a/libs/sofia-sip/libsofia-sip-ua/su/su_localinfo.c b/libs/sofia-sip/libsofia-sip-ua/su/su_localinfo.c index 47e951f144..492900f16e 100644 --- a/libs/sofia-sip/libsofia-sip-ua/su/su_localinfo.c +++ b/libs/sofia-sip/libsofia-sip-ua/su/su_localinfo.c @@ -228,11 +228,15 @@ int su_getlocalinfo(su_localinfo_t const *hints, #endif case AF_INET: +#ifndef USE_LOCALINFO0 ip4 = 1; +#endif break; case 0: +#ifndef USE_LOCALINFO0 ip4 = 1; +#endif #if SU_HAVE_IN6 ip6 = 1; #endif