Fixed potential memory corruption when loading personal item tracker notes (#2512)

This commit is contained in:
Evgenii Babinets 2023-02-23 01:13:32 -05:00 committed by GitHub
parent 4a4f7e6d96
commit e8e4afbbcd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 0 deletions

View File

@ -1102,6 +1102,7 @@ void InitItemTracker() {
});
Ship::RegisterHook<Ship::LoadFile>([](uint32_t fileNum) {
const char* initialTrackerNotes = CVarGetString(("gItemTrackerNotes" + std::to_string(fileNum)).c_str(), "");
itemTrackerNotes.resize(strlen(initialTrackerNotes) + 1);
strcpy(itemTrackerNotes.Data, initialTrackerNotes);
});
Ship::RegisterHook<Ship::DeleteFile>([](uint32_t fileNum) {