mirror of
https://gitea.osmocom.org/cellular-infrastructure/osmo-mgw.git
synced 2025-10-23 08:12:01 +00:00
nat: Access data_ptr after we have checked the length
This commit is contained in:
@@ -1026,15 +1026,15 @@ static struct msgb *rewrite_sms(struct bsc_nat *nat, struct msgb *msg,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* look into the phone number */
|
||||
if ((data_ptr[0] & 0x01) != 1)
|
||||
return NULL;
|
||||
|
||||
if (data_len < 3) {
|
||||
LOGP(DNAT, LOGL_ERROR, "SMS-SUBMIT is too short.\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* look into the phone number */
|
||||
if ((data_ptr[0] & 0x01) != 1)
|
||||
return NULL;
|
||||
|
||||
dest_len = data_ptr[2];
|
||||
if (data_len < dest_len + 3 || dest_len < 2) {
|
||||
LOGP(DNAT, LOGL_ERROR, "SMS-SUBMIT can not have TP-DestAddr.\n");
|
||||
|
Reference in New Issue
Block a user