<p><a href="https://gerrit.osmocom.org/12527">View Change</a></p><p>3 comments:</p><ul style="list-style: none; padding: 0;"><li style="margin: 0; padding: 0;"><p><a href="https://gerrit.osmocom.org/#/c/12527/8/src/hlr_vty_subscr.c">File src/hlr_vty_subscr.c:</a></p><ul style="list-style: none; padding: 0;"><li style="margin: 0; padding: 0 0 0 16px;"><p style="margin-bottom: 4px;"><a href="https://gerrit.osmocom.org/#/c/12527/8/src/hlr_vty_subscr.c@136">Patch Set #8, Line 136:</a> <code style="font-family:monospace,monospace">      char imei_buf[15];</code></p><p><blockquote style="border-left: 1px solid #aaa; margin: 10px 0; padding: 0 10px;">use the constant, what was that, GSM23003_IMEI_MAX_LEN? add + 1 for the '\0'?</blockquote></p><p style="white-space: pre-wrap; word-wrap: break-word;">There is GSM23003_IMEISV_NUM_DIGITS = 15. What we need is something like GSM23003_IMEI_NUM_NO_CHK_DIGITS = 14, added it here: https://gerrit.osmocom.org/#/c/libosmocore/+/12666/ (please review)</p><p style="white-space: pre-wrap; word-wrap: break-word;">...then I can write imei_buf[GSM23003_IMEI_NUM_NO_CHK_DIGITS + 1] and it is obvious what it means.</p></li><li style="margin: 0; padding: 0 0 0 16px;"><p style="margin-bottom: 4px;"><a href="https://gerrit.osmocom.org/#/c/12527/8/src/hlr_vty_subscr.c@149">Patch Set #8, Line 149:</a> <code style="font-family:monospace,monospace">                 osmo_strlcpy(imei_buf, id, 15);</code></p><p><blockquote style="border-left: 1px solid #aaa; margin: 10px 0; padding: 0 10px;">the 15 refers to the sizeof() the target buffer; IMHO this should either be sizeof() or some OSMO_MI […]</blockquote></p><p style="white-space: pre-wrap; word-wrap: break-word;">Well, I had used strncpy before:<br>https://gerrit.osmocom.org/#/c/osmo-hlr/+/12527/6/src/hlr_vty_subscr.c@150</p><p style="white-space: pre-wrap; word-wrap: break-word;">I'll go with osmo_strlcpy and a more explicit comment.</p></li><li style="margin: 0; padding: 0 0 0 16px;"><p style="margin-bottom: 4px;"><a href="https://gerrit.osmocom.org/#/c/12527/8/src/hlr_vty_subscr.c@151">Patch Set #8, Line 151:</a> <code style="font-family:monospace,monospace">            }</code></p><p><blockquote style="border-left: 1px solid #aaa; margin: 10px 0; padding: 0 10px;">what if the digit is present and invalid?</blockquote></p><p style="white-space: pre-wrap; word-wrap: break-word;">It tries to query the IMEI with db_subscr_get_by_imei(), which will tell the user that it is invalid:</p><pre style="font-family: monospace,monospace; white-space: pre-wrap;"> OsmoHLR# subscriber imei 35761300444848 show<br>     ID: 1<br>     IMSI: 123456789023000<br>     MSISDN: none<br>     IMEI: 357613004448485<br> OsmoHLR# subscriber imei 357613004448484 show<br> % No subscriber for imei = '357613004448484'</pre><p style="white-space: pre-wrap; word-wrap: break-word;">I don't think we need to optimize here and make it not query the database, or give out another error message.</p></li></ul></li></ul><p>To view, visit <a href="https://gerrit.osmocom.org/12527">change 12527</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/12527"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: osmo-hlr </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-MessageType: comment </div>
<div style="display:none"> Gerrit-Change-Id: I1af7b573ca2a1cb22497052665012d9c1acf3b30 </div>
<div style="display:none"> Gerrit-Change-Number: 12527 </div>
<div style="display:none"> Gerrit-PatchSet: 8 </div>
<div style="display:none"> Gerrit-Owner: osmith <osmith@sysmocom.de> </div>
<div style="display:none"> Gerrit-Reviewer: Jenkins Builder (1000002) </div>
<div style="display:none"> Gerrit-Reviewer: Neels Hofmeyr <nhofmeyr@sysmocom.de> </div>
<div style="display:none"> Gerrit-Reviewer: Vadim Yanitskiy <axilirator@gmail.com> </div>
<div style="display:none"> Gerrit-Reviewer: osmith <osmith@sysmocom.de> </div>
<div style="display:none"> Gerrit-CC: Max <msuraev@sysmocom.de> </div>
<div style="display:none"> Gerrit-Comment-Date: Mon, 21 Jan 2019 15:47:24 +0000 </div>
<div style="display:none"> Gerrit-HasComments: Yes </div>
<div style="display:none"> Gerrit-HasLabels: No </div>