diff options
author | Vadim Yanitskiy <axilirator@gmail.com> | 2017-11-02 16:41:14 +0700 |
---|---|---|
committer | Vadim Yanitskiy <axilirator@gmail.com> | 2017-11-05 23:41:42 +0700 |
commit | 37872f1032400ea5b1223c79128f7d6bbe002507 (patch) | |
tree | 5e956044e82d2958b389e2d14078b7be94b3f250 /src/host/layer23/src/mobile | |
parent | 584cc7a26b975fb788d8079b6621187a82a401bc (diff) |
mobile/gsm480_ss.c: use secure gsm_7bit_(en|de)code_n_ussd
Since some 'gsm_7bit_*' functions were deprecated and replaced by
more secure ones with the '_n_' suffix in names, it's better to
use the updated functions.
Change-Id: If8a1983592f5800e3981f29962eb333ac9473f40
Diffstat (limited to 'src/host/layer23/src/mobile')
-rw-r--r-- | src/host/layer23/src/mobile/gsm480_ss.c | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/src/host/layer23/src/mobile/gsm480_ss.c b/src/host/layer23/src/mobile/gsm480_ss.c index 8d025e93..ff90faaf 100644 --- a/src/host/layer23/src/mobile/gsm480_ss.c +++ b/src/host/layer23/src/mobile/gsm480_ss.c @@ -532,7 +532,7 @@ static int gsm480_tx_ussd(struct gsm_trans *trans, uint8_t msg_type, } /* Encode service request */ - length = gsm_7bit_encode(msg->data, text); + gsm_7bit_encode_n_ussd(msg->data, msgb_tailroom(msg), text, &length); msgb_put(msg, length); /* Then wrap it as an Octet String */ @@ -772,11 +772,7 @@ static int gsm480_rx_ussd(struct gsm_trans *trans, const uint8_t *data, return -EINVAL; } num_chars = tag_len * 8 / 7; - /* Prevent a mobile-originated buffer-overrun! */ - if (num_chars > sizeof(text) - 1) - num_chars = sizeof(text) - 1; - text[sizeof(text) - 1] = '\0'; - gsm_7bit_decode(text, tag_data, num_chars); + gsm_7bit_decode_n_ussd(text, sizeof(text), tag_data, num_chars); for (i = 0; text[i]; i++) { if (text[i] == '\r') |