Module: kamailio
Branch: master
Commit: 5fe367c098123bf2dcbef2d81d1ad7ff940cb092
URL:
https://github.com/kamailio/kamailio/commit/5fe367c098123bf2dcbef2d81d1ad7f…
Author: herlesupreeth <herlesupreeth(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2023-09-12T09:01:24+02:00
smsops: fixes as per static code analyzer report
---
Modified: src/modules/smsops/smsops_impl.c
---
Diff:
https://github.com/kamailio/kamailio/commit/5fe367c098123bf2dcbef2d81d1ad7f…
Patch:
https://github.com/kamailio/kamailio/commit/5fe367c098123bf2dcbef2d81d1ad7f…
---
diff --git a/src/modules/smsops/smsops_impl.c b/src/modules/smsops/smsops_impl.c
index 10700b37db9..485a814774c 100644
--- a/src/modules/smsops/smsops_impl.c
+++ b/src/modules/smsops/smsops_impl.c
@@ -605,16 +605,18 @@ int utf8_to_ucs2(char *utf8, int utf8_len, char *ucs2, int
buffer_len)
} else if((utf8_char & 0xF0) == 0xE0) {
// Three-byte UTF-8 character
codepoint = ((utf8_char & 0x0F) << 12)
- | (((unsigned char)utf8[utf8_index++] & 0x3F) << 6)
- | ((unsigned char)utf8[utf8_index++] & 0x3F);
+ | (((unsigned char)utf8[utf8_index + 1] & 0x3F) << 6)
+ | ((unsigned char)utf8[utf8_index + 2] & 0x3F);
+ utf8_index += 2;
tmp_buff[ucs2_index++] = (uint8_t)(codepoint >> 8);
tmp_buff[ucs2_index++] = (uint8_t)(codepoint & 0xFF);
} else if((utf8_char & 0xF8) == 0xF0) {
// Four-byte UTF-8 character
codepoint = ((utf8_char & 0x07) << 18)
- | (((unsigned char)utf8[utf8_index++] & 0x3F) << 12)
- | (((unsigned char)utf8[utf8_index++] & 0x3F) << 6)
- | ((unsigned char)utf8[utf8_index++] & 0x3F);
+ | (((unsigned char)utf8[utf8_index + 1] & 0x3F) << 12)
+ | (((unsigned char)utf8[utf8_index + 2] & 0x3F) << 6)
+ | ((unsigned char)utf8[utf8_index + 3] & 0x3F);
+ utf8_index += 3;
// Convert to UCS-2 surrogate pair
codepoint -= 0x10000;
high_surrogate = 0xD800 | (codepoint >> 10);