<p style="white-space: pre-wrap; word-wrap: break-word;">generally I wonder whether we should just always drop that luhn check digit and only handle 14 digit IMEIs. Would that simplify anything?</p><p>Patch set 8:<span style="border-radius: 3px; display: inline-block; margin: 0 2px; padding: 4px;background-color: #ffd4d4;">Code-Review -1</span></p><p><a href="https://gerrit.osmocom.org/12527">View Change</a></p><p>5 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 style="white-space: pre-wrap; word-wrap: break-word;">use the constant, what was that, GSM23003_IMEI_MAX_LEN? add + 1 for the '\0'?</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 style="white-space: pre-wrap; word-wrap: break-word;">the 15 refers to the sizeof() the target buffer; IMHO this should either be sizeof() or some OSMO_MIN() that includes sizeof(), just in case we modify above buffer size and forget about this?</p><p style="white-space: pre-wrap; word-wrap: break-word;">It's a bit ugly to truncate using osmo_strlcpy(). I think I also used that once, but the reader isn't necessarily aware of the -1 behavior.</p><p style="white-space: pre-wrap; word-wrap: break-word;">If you want to keep this and avoid strncpy(), then explain in a comment what is happening.</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 style="white-space: pre-wrap; word-wrap: break-word;">what if the digit is present and invalid?</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@537">Patch Set #8, Line 537:</a> <code style="font-family:monospace,monospace">    char imei_buf[15];</code></p><p style="white-space: pre-wrap; word-wrap: break-word;">same; clarify the size and +1 for nul...</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@544">Patch Set #8, Line 544:</a> <code style="font-family:monospace,monospace">                    osmo_strlcpy(imei_buf, imei, 15);</code></p><p style="white-space: pre-wrap; word-wrap: break-word;">same as above</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 14:32:17 +0000 </div>
<div style="display:none"> Gerrit-HasComments: Yes </div>
<div style="display:none"> Gerrit-HasLabels: Yes </div>