[PATCH] openbsc[master]: Fix potential segfault in sgsn_libgtp.c

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

Max gerrit-no-reply at lists.osmocom.org
Thu Mar 2 12:31:23 UTC 2017


Review at  https://gerrit.osmocom.org/1961

Fix potential segfault in sgsn_libgtp.c

* print pdp->address instead of mm->imsi if mm is NULL
* print mm->imsi in debug log (move it below NULL check)

Change-Id: I4fbf5a54019a46612fbc528d61120182738f9205
---
M openbsc/src/gprs/sgsn_libgtp.c
1 file changed, 5 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/61/1961/1

diff --git a/openbsc/src/gprs/sgsn_libgtp.c b/openbsc/src/gprs/sgsn_libgtp.c
index dde1e5e..c26abc9 100644
--- a/openbsc/src/gprs/sgsn_libgtp.c
+++ b/openbsc/src/gprs/sgsn_libgtp.c
@@ -641,8 +641,6 @@
 	struct msgb *msg;
 	uint8_t *ud;
 
-	DEBUGP(DGPRS, "GTP DATA IND from GGSN, length=%u\n", len);
-
 	pdp = lib->priv;
 	if (!pdp) {
 		LOGP(DGPRS, LOGL_NOTICE,
@@ -652,10 +650,14 @@
 	mm = pdp->mm;
 	if (!mm) {
 		LOGP(DGPRS, LOGL_ERROR,
-		     "PDP context (imsi=%s) without MM context!\n", mm->imsi);
+		     "PDP context (address=%u) without MM context!\n",
+		     pdp->address);
 		return -EIO;
 	}
 
+	DEBUGP(DGPRS, "GTP DATA IND from GGSN for %s, length=%u\n", mm->imsi,
+	       len);
+
 	if (mm->ran_type == MM_CTX_T_UTRAN_Iu) {
 #ifdef BUILD_IU
 		/* Ignore the packet for now and page the UE to get the RAB

-- 
To view, visit https://gerrit.osmocom.org/1961
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I4fbf5a54019a46612fbc528d61120182738f9205
Gerrit-PatchSet: 1
Gerrit-Project: openbsc
Gerrit-Branch: master
Gerrit-Owner: Max <msuraev at sysmocom.de>



More information about the gerrit-log mailing list