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.
This commit is contained in:
@@ -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)));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user