aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <zecke@selfish.org>2012-01-10 13:04:40 +0100
committerHolger Hans Peter Freyther <zecke@selfish.org>2012-01-10 13:04:40 +0100
commit5d2a30a83c8066052fd68302854ca1e61bf7e96c (patch)
tree62cbb636d0e0957d184deb109f37917ac331f7d2 /openbsc
parentc5df08b388ad17d017f45284d56728fd30fe63d8 (diff)
nat: Access data_ptr after we have checked the length
Diffstat (limited to 'openbsc')
-rw-r--r--openbsc/src/osmo-bsc_nat/bsc_nat_utils.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/openbsc/src/osmo-bsc_nat/bsc_nat_utils.c b/openbsc/src/osmo-bsc_nat/bsc_nat_utils.c
index d4798c71f..9e1b42538 100644
--- a/openbsc/src/osmo-bsc_nat/bsc_nat_utils.c
+++ b/openbsc/src/osmo-bsc_nat/bsc_nat_utils.c
@@ -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");