aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNeels Hofmeyr <nhofmeyr@sysmocom.de>2016-12-16 13:09:00 +0100
committerNeels Hofmeyr <nhofmeyr@sysmocom.de>2016-12-18 16:58:41 +0000
commitea619f17048ed6b3e7cf730901e7bc27c1f3f7ed (patch)
tree2710f517f0c4780d4e4e9bf8ce9044b95f754ba8
parentecdfd6d097eb0030b1a0a003fb855b38733f9ba6 (diff)
gtphub: fix possible NULL deref: don't print NULL tunnel
Fixes: coverity CID#158302 Change-Id: Ic500a3eb0c49393c7962a20e61eb57fd467208d3
-rw-r--r--openbsc/src/gprs/gtphub.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/openbsc/src/gprs/gtphub.c b/openbsc/src/gprs/gtphub.c
index 58300ea13..a0af42bee 100644
--- a/openbsc/src/gprs/gtphub.c
+++ b/openbsc/src/gprs/gtphub.c
@@ -1039,6 +1039,9 @@ const char *gtphub_tunnel_str(struct gtphub_tunnel *tun)
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));