Module: kamailio
Branch: master
Commit: f9f16a6c700a7378fc30f6f9c0a767438fc638b9
URL:
https://github.com/kamailio/kamailio/commit/f9f16a6c700a7378fc30f6f9c0a7674…
Author: Aleksandar Yosifov <alexyosifov(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2022-03-10T10:46:26+01:00
smsops: Fix ucs2-to-utf8 for Accent chars
---
Modified: src/modules/smsops/smsops_impl.c
---
Diff:
https://github.com/kamailio/kamailio/commit/f9f16a6c700a7378fc30f6f9c0a7674…
Patch:
https://github.com/kamailio/kamailio/commit/f9f16a6c700a7378fc30f6f9c0a7674…
---
diff --git a/src/modules/smsops/smsops_impl.c b/src/modules/smsops/smsops_impl.c
index 909ccde4e2..9d1e19c237 100644
--- a/src/modules/smsops/smsops_impl.c
+++ b/src/modules/smsops/smsops_impl.c
@@ -479,7 +479,7 @@ int gsm_to_ascii(char* buffer, int buffer_length, str sms, const int
fill_bits)
int ucs2_to_utf8 (int ucs2, char * utf8) {
if (ucs2 < 0x80) {
utf8[0] = ucs2;
- utf8[1] = 0;
+ utf8[1] = 0;
return 1;
}
if (ucs2 >= 0x80 && ucs2 < 0x800) {
@@ -888,7 +888,7 @@ int decode_3gpp_sms(struct sip_msg *msg) {
// Length is worst-case 2 * len (UCS2 is 2 Bytes, UTF8 is worst-case 4 Bytes)
rp_data->pdu.payload.sm.len = 0;
while (len > 0) {
- j = (body.s[p] << 8) + body.s[p + 1];
+ j = ((unsigned char)body.s[p] << 8) + (unsigned char)body.s[p + 1];
p += 2;
rp_data->pdu.payload.sm.len += ucs2_to_utf8(j,
&rp_data->pdu.payload.sm.s[rp_data->pdu.payload.sm.len]);
len -= 2;