diff options
Diffstat (limited to 'src/gsm')
-rw-r--r-- | src/gsm/gsup.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/gsm/gsup.c b/src/gsm/gsup.c index a3d9eef5..2e6690ee 100644 --- a/src/gsm/gsup.c +++ b/src/gsm/gsup.c @@ -332,9 +332,11 @@ int osmo_gsup_decode(const uint8_t *const_data, size_t data_len, * before the value part already contains this length so we can use it * here. */ - OSMO_ASSERT(value[-1] == value_len); - gsm48_decode_bcd_number(gsup_msg->imsi, sizeof(gsup_msg->imsi), - value - 1, 0); + if (gsm48_decode_bcd_number2(gsup_msg->imsi, sizeof(gsup_msg->imsi), + value - 1, value_len + 1, 0)) { + LOGP(DLGSUP, LOGL_ERROR, "Cannot decode IMSI\n"); + return -GMM_CAUSE_INV_MAND_INFO; + } /* specific parts */ while (data_len > 0) { |