From 0e282735509e24ee360876adaafe45992816b5df Mon Sep 17 00:00:00 2001 From: Ivan Kluchnikov Date: Tue, 16 May 2017 19:37:47 +0300 Subject: ussd: Avoid crashing when no connection is present in the transaction If we get a ussd response for transaction, but there is no connection for this transaction, we will now complain, delete the message and return. --- openbsc/src/libmsc/ussd.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/openbsc/src/libmsc/ussd.c b/openbsc/src/libmsc/ussd.c index 23adfeef1..604c686d3 100644 --- a/openbsc/src/libmsc/ussd.c +++ b/openbsc/src/libmsc/ussd.c @@ -218,6 +218,13 @@ int on_ussd_response(struct gsm_network *net, msgb_put(msg, reqhdr->component_length); ssrep.transaction_id = (trans->transaction_id << 4) ^ 0x80; + + if (!trans->conn) { + DEBUGP(DSS, "No connection for transaction with id: %d\n", + trans->transaction_id); + msgb_free(msg); + return -1; + } rc = gsm0480_send_component(trans->conn, msg, &ssrep); if (reqhdr->message_type == GSM0480_MTYPE_RELEASE_COMPLETE) { -- cgit v1.2.3