[PATCH] 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
Fri Dec 16 12:15:31 UTC 2016


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

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(-)


  git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/39/1439/1

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: newchange
Gerrit-Change-Id: Ic500a3eb0c49393c7962a20e61eb57fd467208d3
Gerrit-PatchSet: 1
Gerrit-Project: openbsc
Gerrit-Branch: master
Gerrit-Owner: Neels Hofmeyr <nhofmeyr at sysmocom.de>



More information about the gerrit-log mailing list