Change in osmo-pcu[master]: gprs_ms: Small clean ups in IMSI storage related code

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

pespin gerrit-no-reply at lists.osmocom.org
Fri Jun 26 11:09:54 UTC 2020


pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-pcu/+/19021 )


Change subject: gprs_ms: Small clean ups in IMSI storage related code
......................................................................

gprs_ms: Small clean ups in IMSI storage related code

Change-Id: I987af0d33b79302c037d062c9d1c828a0e027147
---
M src/gprs_ms.cpp
M src/gprs_ms.h
2 files changed, 5 insertions(+), 4 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-pcu refs/changes/21/19021/1

diff --git a/src/gprs_ms.cpp b/src/gprs_ms.cpp
index 1ec8eda..341826c 100644
--- a/src/gprs_ms.cpp
+++ b/src/gprs_ms.cpp
@@ -120,7 +120,7 @@
 
 	LOGP(DRLCMAC, LOGL_INFO, "Creating MS object, TLLI = 0x%08x\n", tlli);
 
-	m_imsi[0] = 0;
+	m_imsi[0] = '\0';
 	memset(&m_timer, 0, sizeof(m_timer));
 	m_timer.cb = GprsMs::timeout;
 	m_llc_queue.init();
@@ -463,8 +463,7 @@
 		"Modifying MS object, TLLI = 0x%08x, IMSI '%s' -> '%s'\n",
 		tlli(), m_imsi, imsi);
 
-	strncpy(m_imsi, imsi, sizeof(m_imsi));
-	m_imsi[sizeof(m_imsi) - 1] = '\0';
+	osmo_strlcpy(m_imsi, imsi, sizeof(m_imsi));
 }
 
 void GprsMs::set_ta(uint8_t ta_)
diff --git a/src/gprs_ms.h b/src/gprs_ms.h
index f7b5c36..1e5a155 100644
--- a/src/gprs_ms.h
+++ b/src/gprs_ms.h
@@ -32,6 +32,8 @@
 	#include <osmocom/core/timer.h>
 	#include <osmocom/core/linuxlist.h>
 
+	#include <osmocom/gsm/protocol/gsm_23_003.h>
+
 	#include "coding_scheme.h"
 }
 
@@ -159,7 +161,7 @@
 	uint32_t m_new_dl_tlli;
 
 	/* store IMSI for look-up and PCH retransmission */
-	char m_imsi[16];
+	char m_imsi[OSMO_IMSI_BUF_SIZE];
 	uint8_t m_ta;
 	uint8_t m_ms_class;
 	uint8_t m_egprs_ms_class;

-- 
To view, visit https://gerrit.osmocom.org/c/osmo-pcu/+/19021
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-pcu
Gerrit-Branch: master
Gerrit-Change-Id: I987af0d33b79302c037d062c9d1c828a0e027147
Gerrit-Change-Number: 19021
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pespin at sysmocom.de>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20200626/76e24085/attachment.htm>


More information about the gerrit-log mailing list