[MME] Protection code for No IMSI (#2613, #2614)

This commit is contained in:
Sukchan Lee 2023-09-16 22:27:21 +09:00
parent a3a683e5a6
commit 8a3dbd44ae
2 changed files with 9 additions and 0 deletions

View File

@ -24,6 +24,8 @@ void ogs_nas_eps_imsi_to_bcd(
{
int bcd_len;
ogs_assert(imsi && imsi_len);
bcd[0] = '0' + imsi->digit1;
bcd[1] = '0' + imsi->digit2;
bcd[2] = '0' + imsi->digit3;

View File

@ -3250,6 +3250,13 @@ mme_ue_t *mme_ue_find_by_message(ogs_nas_eps_message_t *message)
switch(eps_mobile_identity->imsi.type) {
case OGS_NAS_EPS_MOBILE_IDENTITY_IMSI:
if (sizeof(ogs_nas_mobile_identity_imsi_t) !=
eps_mobile_identity->length) {
ogs_error("mobile_identity length (%d != %d)",
(int)sizeof(ogs_nas_mobile_identity_imsi_t),
eps_mobile_identity->length);
return NULL;
}
ogs_nas_eps_imsi_to_bcd(
&eps_mobile_identity->imsi, eps_mobile_identity->length,
imsi_bcd);