diff options
author | Sybren A. Stüvel <sybren@blender.org> | 2021-12-06 19:42:07 +0300 |
---|---|---|
committer | Sybren A. Stüvel <sybren@blender.org> | 2021-12-06 19:42:16 +0300 |
commit | 86992a96b8ae77c879e1f4b9c55ec05bfccec0a9 (patch) | |
tree | 59c4e66ea7575ec20470cdb40a5a501cac20ddf2 /source/blender/editors/asset | |
parent | c2292b2cd62ae3155928385251bbcb1a00c29ad1 (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/asset')
-rw-r--r-- | source/blender/editors/asset/intern/asset_indexer.cc | 2 |
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))); } |