From cc918cb416e129fd6e3f3deec7e03c3f54a83535 Mon Sep 17 00:00:00 2001 From: Neels Hofmeyr Date: Thu, 28 Nov 2019 02:16:34 +0100 Subject: [PATCH] fail on invalid RTP address from MGW When the CRCX OK returns an invalid RTP address, abort the call; fixes MSC_Tests.TC_invalid_mgcp_crash. The original crash happened when adding this error handling without this commit I08c03946605aa12e0a5ce8b3c773704ef5327a7a ("fsm: use deferred deallocation" for osmo-mgw I7df2e9202b04e7ca7366bb0a8ec53cf3bb14faf3 "fix use-after-free: require new fsm deferred dealloc, check for term"). With this error handling added, even though avoiding a crash, the test does not pass yet, because instead of rejecting the call, it currently composes an Assignment Command without a Transport Layer Address. Fix that. Change-Id: I00c3b5ff74c05bcc2b7c39375c33419916a57193 --- src/libmsc/msc_a.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/libmsc/msc_a.c b/src/libmsc/msc_a.c index 0b07fbc98..a4048f452 100644 --- a/src/libmsc/msc_a.c +++ b/src/libmsc/msc_a.c @@ -627,6 +627,12 @@ static void msc_a_fsm_communicating(struct osmo_fsm_inst *fi, uint32_t event, vo LOG_MSC_A(msc_a, LOGL_ERROR, "Invalid data for %s\n", osmo_fsm_event_name(fi->fsm, event)); return; } + if (!osmo_sockaddr_str_is_nonzero(&rtps->local)) { + LOG_MSC_A(msc_a, LOGL_ERROR, "Invalid RTP address received from MGW: " OSMO_SOCKADDR_STR_FMT "\n", + OSMO_SOCKADDR_STR_FMT_ARGS(&rtps->local)); + call_leg_release(msc_a->cc.call_leg); + return; + } LOG_MSC_A(msc_a, LOGL_DEBUG, "MGW endpoint's RTP address available for the CI %s: " OSMO_SOCKADDR_STR_FMT " (osmux=%s:%d)\n", rtp_direction_name(rtps->dir), OSMO_SOCKADDR_STR_FMT_ARGS(&rtps->local),