Change in libosmo-sccp[master]: ipa: Fix crash when parsing of received IPA SCCP message fails

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

laforge gerrit-no-reply at lists.osmocom.org
Sat Oct 19 15:28:12 UTC 2019


laforge has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmo-sccp/+/15813 )


Change subject: ipa: Fix crash when parsing of received IPA SCCP message fails
......................................................................

ipa: Fix crash when parsing of received IPA SCCP message fails

If an IPA ASP is sending us a SCCP message that cannot be parsed,
we shouldn't crash but handle this gracefully.

While at it, also add some more logging to various realted error paths.

Change-Id: Ib7a8c2a36dd1b82ca8ed472760c1682ede50cb90
Fixes: OS#4236
---
M src/ipa.c
1 file changed, 8 insertions(+), 0 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/libosmo-sccp refs/changes/13/15813/1

diff --git a/src/ipa.c b/src/ipa.c
index d013916..bae88ac 100644
--- a/src/ipa.c
+++ b/src/ipa.c
@@ -178,6 +178,7 @@
 		xua_msg_add_sccp_addr(sua, SUA_IEI_DEST_ADDR, &addr);
 		break;
 	case -ENODEV: /* no destination address in message */
+		LOGPASP(asp, DLSS7, LOGL_ERROR, "No destinatin address in SUA\n");
 		break;
 	default: /* some other error */
 		xua_msg_free(sua);
@@ -196,6 +197,7 @@
 		xua_msg_add_sccp_addr(sua, SUA_IEI_SRC_ADDR, &addr);
 		break;
 	case -ENODEV: /* no source address in message */
+		LOGPASP(asp, DLSS7, LOGL_ERROR, "No source address in SUA\n");
 		break;
 	default: /* some other error */
 		xua_msg_free(sua);
@@ -204,6 +206,8 @@
 
 	/* re-encode SUA to SCCP and return */
 	sccp_msg_out = osmo_sua_to_sccp(sua);
+	if (!sccp_msg_out)
+		LOGPASP(asp, DLSS7, LOGL_ERROR, "Couldn't re-encode SUA to SCCP\n");
 	xua_msg_free(sua);
 	return sccp_msg_out;
 }
@@ -259,6 +263,10 @@
 
 	/* Second, patch this into the SCCP message */
 	msg = patch_sccp_with_pc(asp, msg, opc, dpc);
+	if (!msg) {
+		LOGPASP(asp, DLSS7, LOGL_ERROR, "Unable to patch PC into SCCP message; dropping\n");
+		return -1;
+	}
 
 	/* Third, create a MTP3/M3UA label with those point codes */
 	memset(&data_hdr, 0, sizeof(data_hdr));

-- 
To view, visit https://gerrit.osmocom.org/c/libosmo-sccp/+/15813
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: libosmo-sccp
Gerrit-Branch: master
Gerrit-Change-Id: Ib7a8c2a36dd1b82ca8ed472760c1682ede50cb90
Gerrit-Change-Number: 15813
Gerrit-PatchSet: 1
Gerrit-Owner: laforge <laforge at osmocom.org>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20191019/af9407e8/attachment.htm>


More information about the gerrit-log mailing list