Change in osmo-bsc[master]: prevent a NULL pointer dereference in debug_candidate()

Stefan Sperling gerrit-no-reply at lists.osmocom.org
Tue Nov 6 14:51:27 UTC 2018


Stefan Sperling has uploaded this change for review. ( https://gerrit.osmocom.org/11630


Change subject: prevent a NULL pointer dereference in debug_candidate()
......................................................................

prevent a NULL pointer dereference in debug_candidate()

Prevent a potential NULL pointer dereference in debug logging
of the handover decision 2 implementation. The existing logic
didn't correctly account for the fact that bts->candidate may
be a NULL pointer.

Change-Id: Ie3d672d835bbc136809e593a819a6dda7c84a88e
Related: CID#188880
---
M src/osmo-bsc/handover_decision_2.c
1 file changed, 15 insertions(+), 12 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-bsc refs/changes/30/11630/1

diff --git a/src/osmo-bsc/handover_decision_2.c b/src/osmo-bsc/handover_decision_2.c
index a8fff63..833b1d0 100644
--- a/src/osmo-bsc/handover_decision_2.c
+++ b/src/osmo-bsc/handover_decision_2.c
@@ -827,18 +827,21 @@
 				    "RX level %d -> %d\n",
 				    rxlev2dbm(rxlev), rxlev2dbm(candidate->avg));
 
-	if (candidate->bts == lchan->ts->trx->bts)
-		LOGPHOLCHANTOBTS(lchan, candidate->bts, LOGL_DEBUG,
-		     "RX level %d; "
-		     HO_CANDIDATE_FMT(f, F) "; " HO_CANDIDATE_FMT(h, H) "\n",
-		     rxlev2dbm(candidate->avg),
-		     HO_CANDIDATE_ARGS(f, F), HO_CANDIDATE_ARGS(h, H));
-	else if (candidate->bts)
-		LOGPHOLCHANTOBTS(lchan, candidate->bts, LOGL_DEBUG,
-		     "RX level %d -> %d; "
-		     HO_CANDIDATE_FMT(f, F) "; " HO_CANDIDATE_FMT(h, H) "\n",
-		     rxlev2dbm(rxlev), rxlev2dbm(candidate->avg),
-		     HO_CANDIDATE_ARGS(f, F), HO_CANDIDATE_ARGS(h, H));
+	if (candidate->bts) {
+		if (candidate->bts == lchan->ts->trx->bts) {
+			LOGPHOLCHANTOBTS(lchan, candidate->bts, LOGL_DEBUG,
+			     "RX level %d; "
+			     HO_CANDIDATE_FMT(f, F) "; " HO_CANDIDATE_FMT(h, H) "\n",
+			     rxlev2dbm(candidate->avg),
+			     HO_CANDIDATE_ARGS(f, F), HO_CANDIDATE_ARGS(h, H));
+		} else {
+			LOGPHOLCHANTOBTS(lchan, candidate->bts, LOGL_DEBUG,
+			     "RX level %d -> %d; "
+			     HO_CANDIDATE_FMT(f, F) "; " HO_CANDIDATE_FMT(h, H) "\n",
+			     rxlev2dbm(rxlev), rxlev2dbm(candidate->avg),
+			     HO_CANDIDATE_ARGS(f, F), HO_CANDIDATE_ARGS(h, H));
+		}
+	}
 }
 
 /* add candidate for re-assignment within the current cell */

-- 
To view, visit https://gerrit.osmocom.org/11630
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie3d672d835bbc136809e593a819a6dda7c84a88e
Gerrit-Change-Number: 11630
Gerrit-PatchSet: 1
Gerrit-Owner: Stefan Sperling <ssperling at sysmocom.de>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20181106/4c86ace5/attachment.html>


More information about the gerrit-log mailing list