Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2021-08-28 15:44:55 +0300
committerCampbell Barton <ideasman42@gmail.com>2021-08-28 15:50:52 +0300
commit457302b67b9de6a92240c2736306cfa01187101d (patch)
treeeaa6c9fc065aa7fd3730270027f121b709e054ac /source/blender/editors/space_text
parent079791dc30571227393db525704baea7540fb5c6 (diff)
BLI_string_utf8: add buffer size arg to BLI_str_utf8_from_unicode
Besides helping to avoid buffer overflow errors this reduces complexity of BLI_str_utf32_as_utf8 which needed a special loop for the last 6 characters to avoid writing past the buffer bounds. Also add BLI_str_utf8_from_unicode_len which only returns the length.
Diffstat (limited to 'source/blender/editors/space_text')
-rw-r--r--source/blender/editors/space_text/text_ops.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/source/blender/editors/space_text/text_ops.c b/source/blender/editors/space_text/text_ops.c
index b7185766224..c3bc474b98a 100644
--- a/source/blender/editors/space_text/text_ops.c
+++ b/source/blender/editors/space_text/text_ops.c
@@ -3486,7 +3486,7 @@ static int text_insert_invoke(bContext *C, wmOperator *op, const wmEvent *event)
}
else {
/* in theory, ghost can set value to extended ascii here */
- len = BLI_str_utf8_from_unicode(event->ascii, str);
+ len = BLI_str_utf8_from_unicode(event->ascii, str, sizeof(str) - 1);
}
str[len] = '\0';
RNA_string_set(op->ptr, "text", str);