aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc
diff options
context:
space:
mode:
authorSergey Kostanbaev <sergey.kostanbaev@gmail.com>2016-02-10 04:06:54 +0300
committerIvan Kluchnikov <kluchnikovi@gmail.com>2017-02-07 18:59:54 +0300
commitda8c96e097da1c797f151fea4676da9c8e8c1265 (patch)
treeec55669b7a5dcfb82d77551d32559ecb5b1f3302 /openbsc
parentd4839fe14a0d060933f0006d10dc932375a7c7d6 (diff)
recovery latin1 USSD message, probably bad rebase
Diffstat (limited to 'openbsc')
-rw-r--r--openbsc/src/ussd-proxy/ussd_proxy.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/openbsc/src/ussd-proxy/ussd_proxy.c b/openbsc/src/ussd-proxy/ussd_proxy.c
index 572989b10..3aaab6512 100644
--- a/openbsc/src/ussd-proxy/ussd_proxy.c
+++ b/openbsc/src/ussd-proxy/ussd_proxy.c
@@ -1108,7 +1108,7 @@ int ussd_send_data(operation_t *op, int last, const char* lang, unsigned lang_le
&outbuf, &outleft);
if (s == (size_t)-1) {
outbuf = (char*)ss.ussd_text;
- outleft = MAX_LEN_USSD_STRING;
+ outleft = MAX_ASN1_LEN_USSD_STRING;
s = iconv(op->ctx->utf8_to_ucs2,
&inbuf, &inleft,
@@ -1122,11 +1122,13 @@ int ussd_send_data(operation_t *op, int last, const char* lang, unsigned lang_le
} else {
int outlen;
+ size_t len = (msg_len > MAX_LEN_USSD_STRING) ?
+ MAX_LEN_USSD_STRING : msg_len;
+ memcpy(tmpbuf, msg, len);
+ tmpbuf[len] = 0;
- // Set null-termination
- outbuf[0] = 0;
gsm_7bit_encode_n_ussd(ss.ussd_text,
- MAX_LEN_USSD_STRING, outbuf, &outlen);
+ MAX_ASN1_LEN_USSD_STRING, tmpbuf, &outlen);
ss.ussd_text_len = outlen;
ss.ussd_text_language = 0x0f;
}