pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmocom-bb/+/32436 )
Change subject: layer23: Use OSMO_IMSI_BUF_SIZE from libosmocore ......................................................................
layer23: Use OSMO_IMSI_BUF_SIZE from libosmocore
Change-Id: I295444bb3b75ed236ea4af5563d9a9c9e590cab7 --- M src/host/layer23/include/osmocom/bb/common/subscriber.h M src/host/layer23/src/common/subscriber.c 2 files changed, 13 insertions(+), 4 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmocom-bb refs/changes/36/32436/1
diff --git a/src/host/layer23/include/osmocom/bb/common/subscriber.h b/src/host/layer23/include/osmocom/bb/common/subscriber.h index 8b15295..9f945e9 100644 --- a/src/host/layer23/include/osmocom/bb/common/subscriber.h +++ b/src/host/layer23/include/osmocom/bb/common/subscriber.h @@ -1,6 +1,8 @@ #ifndef _SUBSCRIBER_H #define _SUBSCRIBER_H
+#include <osmocom/gsm/protocol/gsm_23_003.h> + /* GSM 04.08 4.1.2.2 SIM update status */ #define GSM_SIM_U0_NULL 0 #define GSM_SIM_U1_UPDATED 1 @@ -18,8 +20,6 @@ uint8_t cause; };
-#define GSM_IMSI_LENGTH 16 - #define GSM_SIM_IS_READER(type) \ (type == GSM_SIM_TYPE_L1PHY || type == GSM_SIM_TYPE_SAP)
@@ -40,7 +40,7 @@ uint8_t imsi_attached; /* attached state */
/* IMSI & co */ - char imsi[GSM_IMSI_LENGTH]; + char imsi[OSMO_IMSI_BUF_SIZE]; char msisdn[31]; /* may include access codes */ char iccid[21]; /* 20 + termination */
diff --git a/src/host/layer23/src/common/subscriber.c b/src/host/layer23/src/common/subscriber.c index 1683b09..6b18e7c 100644 --- a/src/host/layer23/src/common/subscriber.c +++ b/src/host/layer23/src/common/subscriber.c @@ -229,7 +229,7 @@
/* decode IMSI, skip first digit (parity) */ imsi = sim_decode_bcd(data + 1, length); - if (strlen(imsi) - 1 > GSM_IMSI_LENGTH - 1 || strlen(imsi) - 1 < 6) { + if (strlen(imsi) - 1 > OSMO_IMSI_BUF_SIZE - 1 || strlen(imsi) - 1 < 6) { LOGP(DMM, LOGL_NOTICE, "IMSI invalid length = %zu\n", strlen(imsi) - 1); return -EINVAL;