aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVadim Yanitskiy <vyanitskiy@sysmocom.de>2020-12-02 11:42:01 +0100
committerVadim Yanitskiy <vyanitskiy@sysmocom.de>2020-12-02 11:45:51 +0100
commit8c03bf3f3c58afa582ed000ba05e886b593256f9 (patch)
treead2bb441b9a05253294919faa2a389c16a8516ae
parent18aff1fc46823dfc45685d99972430f6f4a49784 (diff)
gsm_08_08: fix NULL pointer dereference in bsc_cm_update()
MS Classmark 3 is optional, and thus can be NULL. Change-Id: I4f1455a3db4972ea9843564b590e405c51083b47 Fixes: I39ae439d05562b35b2e47774dc92f8789fea1a57 Fixes: CID#215593 "Explicit null dereferenced"
-rw-r--r--src/osmo-bsc/gsm_08_08.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/src/osmo-bsc/gsm_08_08.c b/src/osmo-bsc/gsm_08_08.c
index 9c5cf2faf..52a92c8f8 100644
--- a/src/osmo-bsc/gsm_08_08.c
+++ b/src/osmo-bsc/gsm_08_08.c
@@ -603,13 +603,15 @@ void bsc_cm_update(struct gsm_subscriber_connection *conn,
}
conn_update_ms_power_class(conn, rc8);
- rc = gsm48_decode_classmark3(&conn->cm3, cm3, cm3_len);
- if (rc < 0) {
- LOGP(DMSC, LOGL_NOTICE, "Unable to decode classmark3 during CM Update.\n");
- memset(&conn->cm3, 0, sizeof(conn->cm3));
- conn->cm3_valid = false;
- } else
- conn->cm3_valid = true;
+ if (cm3 != NULL && cm3_len > 0) {
+ rc = gsm48_decode_classmark3(&conn->cm3, cm3, cm3_len);
+ if (rc < 0) {
+ LOGP(DMSC, LOGL_NOTICE, "Unable to decode classmark3 during CM Update.\n");
+ memset(&conn->cm3, 0, sizeof(conn->cm3));
+ conn->cm3_valid = false;
+ } else
+ conn->cm3_valid = true;
+ }
if (!msc_connected(conn))
return;