summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas Eversberg <jolly@eversberg.eu>2013-01-06 11:48:20 +0100
committerAndreas Eversberg <jolly@eversberg.eu>2013-01-06 11:48:20 +0100
commitf0964c1d6752284f2fb7013f276a31f6aa08f9a2 (patch)
tree4da639961a452fa9bb88293be9ad31d1f6961084
parentdb536954528ad3c9344444f26181898175fc77a5 (diff)
mobile: Fix user-info message transcoding
A setup message may only contain up to 32 digits. The presence of user information must be checked after parsing user-info message.
-rw-r--r--src/host/layer23/src/mobile/gsm48_cc.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/host/layer23/src/mobile/gsm48_cc.c b/src/host/layer23/src/mobile/gsm48_cc.c
index 38dfab0..a64f032 100644
--- a/src/host/layer23/src/mobile/gsm48_cc.c
+++ b/src/host/layer23/src/mobile/gsm48_cc.c
@@ -1320,8 +1320,10 @@ static int gsm48_cc_tx_userinfo(struct gsm_trans *trans, void *arg)
gh->msg_type = GSM48_MT_CC_USER_INFO;
/* user-user */
- if (user->fields & MNCC_F_USERUSER)
+ if (user->fields & MNCC_F_USERUSER) {
+ user->useruser.info[32] = '\0'; /* only up to 32 chars */
gsm48_encode_useruser(nmsg, 1, &user->useruser);
+ }
/* more data */
if (user->more)
gsm48_encode_more(nmsg);
@@ -1349,8 +1351,11 @@ static int gsm48_cc_rx_userinfo(struct gsm_trans *trans, struct msgb *msg)
tlv_parse(&tp, &gsm48_att_tlvdef, gh->data, payload_len,
GSM48_IE_USER_USER, 0);
/* user-user */
- gsm48_decode_useruser(&user.useruser,
- TLVP_VAL(&tp, GSM48_IE_USER_USER)-1);
+ if (TLVP_PRESENT(&tp, GSM48_IE_USER_USER)) {
+ user.fields |= MNCC_F_USERUSER;
+ gsm48_decode_useruser(&user.useruser,
+ TLVP_VAL(&tp, GSM48_IE_USER_USER)-1);
+ }
/* more data */
if (TLVP_PRESENT(&tp, GSM48_IE_MORE_DATA))
user.more = 1;