[MERGED] openbsc[master]: gtphub: fix possible NULL deref: don't print NULL tunnel

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

Neels Hofmeyr gerrit-no-reply at lists.osmocom.org
Sun Dec 18 16:58:41 UTC 2016


Neels Hofmeyr has submitted this change and it was merged.

Change subject: gtphub: fix possible NULL deref: don't print NULL tunnel
......................................................................


gtphub: fix possible NULL deref: don't print NULL tunnel

Fixes: coverity CID#158302
Change-Id: Ic500a3eb0c49393c7962a20e61eb57fd467208d3
---
M openbsc/src/gprs/gtphub.c
1 file changed, 3 insertions(+), 0 deletions(-)

Approvals:
  Neels Hofmeyr: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/openbsc/src/gprs/gtphub.c b/openbsc/src/gprs/gtphub.c
index 58300ea..a0af42b 100644
--- a/openbsc/src/gprs/gtphub.c
+++ b/openbsc/src/gprs/gtphub.c
@@ -1039,6 +1039,9 @@
 	int left = sizeof(buf);
 	int l;
 
+	if (!tun)
+		return "null-tunnel";
+
 	APPEND("TEI=%x: ", tun->tei_repl);
 	APPEND("%s", gtphub_tunnel_side_str(tun, GTPH_SIDE_SGSN));
 	APPEND(" <-> %s", gtphub_tunnel_side_str(tun, GTPH_SIDE_GGSN));

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Ic500a3eb0c49393c7962a20e61eb57fd467208d3
Gerrit-PatchSet: 2
Gerrit-Project: openbsc
Gerrit-Branch: master
Gerrit-Owner: Neels Hofmeyr <nhofmeyr at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Neels Hofmeyr <nhofmeyr at sysmocom.de>



More information about the gerrit-log mailing list