diff options
Diffstat (limited to 'source/blender/blenkernel/intern')
-rw-r--r-- | source/blender/blenkernel/intern/object_dupli.cc | 4 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/text.c | 7 |
2 files changed, 6 insertions, 5 deletions
diff --git a/source/blender/blenkernel/intern/object_dupli.cc b/source/blender/blenkernel/intern/object_dupli.cc index 141a9a25eca..a46ac4b1175 100644 --- a/source/blender/blenkernel/intern/object_dupli.cc +++ b/source/blender/blenkernel/intern/object_dupli.cc @@ -653,10 +653,10 @@ static Object *find_family_object( return *ob_pt; } - char ch_utf8[7]; + char ch_utf8[BLI_UTF8_MAX + 1]; size_t ch_utf8_len; - ch_utf8_len = BLI_str_utf8_from_unicode(ch, ch_utf8); + ch_utf8_len = BLI_str_utf8_from_unicode(ch, ch_utf8, sizeof(ch_utf8) - 1); ch_utf8[ch_utf8_len] = '\0'; ch_utf8_len += 1; /* Compare with null terminator. */ diff --git a/source/blender/blenkernel/intern/text.c b/source/blender/blenkernel/intern/text.c index bdc82fe626c..6b7b3213a83 100644 --- a/source/blender/blenkernel/intern/text.c +++ b/source/blender/blenkernel/intern/text.c @@ -329,7 +329,8 @@ int txt_extended_ascii_as_utf8(char **str) memcpy(newstr + mi, (*str) + i, bad_char); - BLI_str_utf8_from_unicode((*str)[i + bad_char], newstr + mi + bad_char); + const int mofs = mi + bad_char; + BLI_str_utf8_from_unicode((*str)[i + bad_char], newstr + mofs, (length + added) - mofs); i += bad_char + 1; mi += bad_char + 2; } @@ -2005,7 +2006,7 @@ static bool txt_add_char_intern(Text *text, unsigned int add, bool replace_tabs) txt_delete_sel(text); - add_len = BLI_str_utf8_from_unicode(add, ch); + add_len = BLI_str_utf8_from_unicode(add, ch, sizeof(ch)); tmp = MEM_mallocN(text->curl->len + add_len + 1, "textline_string"); @@ -2061,7 +2062,7 @@ bool txt_replace_char(Text *text, unsigned int add) del = BLI_str_utf8_as_unicode_step(text->curl->line, text->curl->len, &del_size); del_size -= text->curc; UNUSED_VARS(del); - add_size = BLI_str_utf8_from_unicode(add, ch); + add_size = BLI_str_utf8_from_unicode(add, ch, sizeof(ch)); if (add_size > del_size) { char *tmp = MEM_mallocN(text->curl->len + add_size - del_size + 1, "textline_string"); |