From ea619f17048ed6b3e7cf730901e7bc27c1f3f7ed Mon Sep 17 00:00:00 2001 From: Neels Hofmeyr Date: Fri, 16 Dec 2016 13:09:00 +0100 Subject: [PATCH] gtphub: fix possible NULL deref: don't print NULL tunnel Fixes: coverity CID#158302 Change-Id: Ic500a3eb0c49393c7962a20e61eb57fd467208d3 --- openbsc/src/gprs/gtphub.c | 3 +++ 1 file changed, 3 insertions(+) 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));