[sr-dev] git:master:f9f16a6c: smsops: Fix ucs2-to-utf8 for Accent chars

Daniel-Constantin Mierla miconda at gmail.com
Thu Mar 10 10:46:31 CET 2022


Module: kamailio
Branch: master
Commit: f9f16a6c700a7378fc30f6f9c0a767438fc638b9
URL: https://github.com/kamailio/kamailio/commit/f9f16a6c700a7378fc30f6f9c0a767438fc638b9

Author: Aleksandar Yosifov <alexyosifov at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at 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/f9f16a6c700a7378fc30f6f9c0a767438fc638b9.diff
Patch: https://github.com/kamailio/kamailio/commit/f9f16a6c700a7378fc30f6f9c0a767438fc638b9.patch

---

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;




More information about the sr-dev mailing list