Neels Hofmeyr has posted comments on this change. ( 
https://gerrit.osmocom.org/12527 )

Change subject: VTY: integrate IMEI
......................................................................


Patch Set 8: Code-Review-1

(5 comments)

generally I wonder whether we should just always drop that luhn check digit and 
only handle 14 digit IMEIs. Would that simplify anything?

https://gerrit.osmocom.org/#/c/12527/8/src/hlr_vty_subscr.c
File src/hlr_vty_subscr.c:

https://gerrit.osmocom.org/#/c/12527/8/src/hlr_vty_subscr.c@136
PS8, Line 136:  char imei_buf[15];
use the constant, what was that, GSM23003_IMEI_MAX_LEN? add + 1 for the '\0'?


https://gerrit.osmocom.org/#/c/12527/8/src/hlr_vty_subscr.c@149
PS8, Line 149:                  osmo_strlcpy(imei_buf, id, 15);
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?

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.

If you want to keep this and avoid strncpy(), then explain in a comment what is 
happening.


https://gerrit.osmocom.org/#/c/12527/8/src/hlr_vty_subscr.c@151
PS8, Line 151:          }
what if the digit is present and invalid?


https://gerrit.osmocom.org/#/c/12527/8/src/hlr_vty_subscr.c@537
PS8, Line 537:  char imei_buf[15];
same; clarify the size and +1 for nul...


https://gerrit.osmocom.org/#/c/12527/8/src/hlr_vty_subscr.c@544
PS8, Line 544:                  osmo_strlcpy(imei_buf, imei, 15);
same as above



--
To view, visit https://gerrit.osmocom.org/12527
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-hlr
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I1af7b573ca2a1cb22497052665012d9c1acf3b30
Gerrit-Change-Number: 12527
Gerrit-PatchSet: 8
Gerrit-Owner: osmith <osm...@sysmocom.de>
Gerrit-Reviewer: Jenkins Builder (1000002)
Gerrit-Reviewer: Neels Hofmeyr <nhofm...@sysmocom.de>
Gerrit-Reviewer: Vadim Yanitskiy <axilira...@gmail.com>
Gerrit-Reviewer: osmith <osm...@sysmocom.de>
Gerrit-CC: Max <msur...@sysmocom.de>
Gerrit-Comment-Date: Mon, 21 Jan 2019 14:32:17 +0000
Gerrit-HasComments: Yes
Gerrit-HasLabels: Yes

Reply via email to