gsm_04_11: use gsm48_decode_bcd_number2(), evaluate rc

Avoid deprecation warning: use gsm48_decode_bcd_number2() instead of
gsm48_decode_bcd_number().

Validate the return value and add error handling.

Change-Id: Ibef71c46d72d2d43123e68f73e5ed554a69243d8
changes/81/13881/5
Neels Hofmeyr 4 years ago
parent 5b1e0309b5
commit 56f90132b8
  1. 8
      src/libmsc/gsm_04_11.c

@ -526,8 +526,12 @@ static int gsm340_rx_tpdu(struct gsm_trans *trans, struct msgb *msg,
gsms->dst.ton = (address_lv[1] >> 4) & 7;
gsms->dst.npi = address_lv[1] & 0xF;
/* convert to real number */
gsm48_decode_bcd_number(gsms->dst.addr,
sizeof(gsms->dst.addr), address_lv, 1);
if (gsm48_decode_bcd_number2(gsms->dst.addr,
sizeof(gsms->dst.addr), address_lv, da_len_bytes, 1)) {
LOG_TRANS(trans, LOGL_ERROR, "Failed to decode destination Address\n");
rc = GSM411_RP_CAUSE_SEMANT_INC_MSG;
goto out;
}
smsp += da_len_bytes;
gsms->protocol_id = *smsp++;

Loading…
Cancel
Save