From 37872f1032400ea5b1223c79128f7d6bbe002507 Mon Sep 17 00:00:00 2001 From: Vadim Yanitskiy Date: Thu, 2 Nov 2017 16:41:14 +0700 Subject: 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 --- src/host/layer23/src/mobile/gsm480_ss.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'src/host') 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') -- cgit v1.2.3