Change in osmo-msc[master]: libmsc: fix potential NULL-pointer dereferences detected by GCC's LTO

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/.

fixeria gerrit-no-reply at lists.osmocom.org
Sun Dec 1 11:53:38 UTC 2019


fixeria has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-msc/+/16357 )


Change subject: libmsc: fix potential NULL-pointer dereferences detected by GCC's LTO
......................................................................

libmsc: fix potential NULL-pointer dereferences detected by GCC's LTO

Change-Id: Ib7ba8909dce64d1b8ff3a53495fe3eefc446ed8e
---
M src/libmsc/msc_ho.c
M src/libmsc/msc_vty.c
2 files changed, 9 insertions(+), 1 deletion(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-msc refs/changes/57/16357/1

diff --git a/src/libmsc/msc_ho.c b/src/libmsc/msc_ho.c
index 99f37b6..a7f306e 100644
--- a/src/libmsc/msc_ho.c
+++ b/src/libmsc/msc_ho.c
@@ -67,9 +67,12 @@
 
 void msc_ho_down_required_reject(struct msc_a *msc_a, enum gsm0808_cause cause)
 {
-	struct msc_i *msc_i = msc_a_msc_i(msc_a);
+	struct msc_i *msc_i;
 	uint32_t event;
 
+	msc_i = msc_a_msc_i(msc_a);
+	OSMO_ASSERT(msc_i);
+
 	struct ran_msg ran_enc_msg = {
 		.msg_type = RAN_MSG_HANDOVER_REQUIRED_REJECT,
 		.handover_required_reject = {
diff --git a/src/libmsc/msc_vty.c b/src/libmsc/msc_vty.c
index f833585..cd82a07 100644
--- a/src/libmsc/msc_vty.c
+++ b/src/libmsc/msc_vty.c
@@ -1148,6 +1148,11 @@
 	struct gsm_sms *sms;
 
 	sms = sms_from_text(receiver, sender_msisdn, 0, str);
+	if (!sms) {
+		LOGP(DLSMS, LOGL_ERROR, "Failed to allocate SMS\n");
+		return CMD_WARNING;
+	}
+
 	sms->protocol_id = tp_pid;
 
 	/* store in database for the queue */

-- 
To view, visit https://gerrit.osmocom.org/c/osmo-msc/+/16357
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-msc
Gerrit-Branch: master
Gerrit-Change-Id: Ib7ba8909dce64d1b8ff3a53495fe3eefc446ed8e
Gerrit-Change-Number: 16357
Gerrit-PatchSet: 1
Gerrit-Owner: fixeria <axilirator at gmail.com>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20191201/abb541b4/attachment.htm>


More information about the gerrit-log mailing list