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:
authorSybren A. Stüvel <sybren@blender.org>2021-12-06 19:42:07 +0300
committerSybren A. Stüvel <sybren@blender.org>2021-12-06 19:42:16 +0300
commit86992a96b8ae77c879e1f4b9c55ec05bfccec0a9 (patch)
tree59c4e66ea7575ec20470cdb40a5a501cac20ddf2 /source/blender/editors
parentc2292b2cd62ae3155928385251bbcb1a00c29ad1 (diff)
Asset Indexer: use fixed-length string for ID code
Use fixed-length string to convert `char[2]` to `std::string`. Otherwise `strlen()` is called, which is problematic as the `char[2]` is not zero-terminated.
Diffstat (limited to 'source/blender/editors')
-rw-r--r--source/blender/editors/asset/intern/asset_indexer.cc2
1 files changed, 1 insertions, 1 deletions
diff --git a/source/blender/editors/asset/intern/asset_indexer.cc b/source/blender/editors/asset/intern/asset_indexer.cc
index 8472b33d3af..4107d28b5e3 100644
--- a/source/blender/editors/asset/intern/asset_indexer.cc
+++ b/source/blender/editors/asset/intern/asset_indexer.cc
@@ -237,7 +237,7 @@ struct AssetEntryWriter {
char idcode_prefix[2];
/* Similar to `BKE_libblock_alloc`. */
*((short *)idcode_prefix) = idcode;
- std::string name_with_idcode = std::string(idcode_prefix) + name;
+ std::string name_with_idcode = std::string(idcode_prefix, sizeof(idcode_prefix)) + name;
attributes.append_as(std::pair(ATTRIBUTE_ENTRIES_NAME, new StringValue(name_with_idcode)));
}