<p>Neels Hofmeyr has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.osmocom.org/13575">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">add OSMO_IMSI_SIZE<br><br>Various places in our code base figure out how many char they need to safely<br>store an IMSI. An IMSI can have a checksum digit, which is not reflected by<br>GSM23003_IMSI_MAX_DIGITS. And we usually needs a terminating \0.<br><br>Instead of having a magic +2 repeated every so often, rather define<br>OSMO_IMSI_SIZE to contain both checksum digit and nul char, and have the<br>explanatory comment with it here in libosmocore.<br><br>Change-Id: Id11ada4c96b79f7f0ad58185ab7dbf24622fb770<br>---<br>M include/osmocom/gsm/protocol/gsm_23_003.h<br>1 file changed, 3 insertions(+), 0 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/75/13575/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/include/osmocom/gsm/protocol/gsm_23_003.h b/include/osmocom/gsm/protocol/gsm_23_003.h</span><br><span>index babd0f4..9dcf4ac 100644</span><br><span>--- a/include/osmocom/gsm/protocol/gsm_23_003.h</span><br><span>+++ b/include/osmocom/gsm/protocol/gsm_23_003.h</span><br><span>@@ -5,6 +5,9 @@</span><br><span> /* Chapter 2.2 */</span><br><span> #define GSM23003_IMSI_MAX_DIGITS      15</span><br><span> #define GSM23003_IMSI_MIN_DIGITS  6</span><br><span style="color: hsl(120, 100%, 40%);">+/*! The char[] buffer size to completely contain an IMSI including the optional checksum digit as well as the</span><br><span style="color: hsl(120, 100%, 40%);">+ * terminating nul character. */</span><br><span style="color: hsl(120, 100%, 40%);">+#define OSMO_IMSI_SIZE (GSM23003_IMSI_MAX_DIGITS+2)</span><br><span> /* Chapter 2.4 */</span><br><span> #define GSM23003_TMSI_NUM_BYTES         4</span><br><span> /* Chapter 2.5 */</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.osmocom.org/13575">change 13575</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://gerrit.osmocom.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.osmocom.org/13575"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: libosmocore </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>
<div style="display:none"> Gerrit-Change-Id: Id11ada4c96b79f7f0ad58185ab7dbf24622fb770 </div>
<div style="display:none"> Gerrit-Change-Number: 13575 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Neels Hofmeyr <nhofmeyr@sysmocom.de> </div>