Fixed rare crash when accessing library import by name

The library name index may only be 8-bits.

This bug was not present in the previous implementation due to a bitmask
(0xFF) - see
ea99ba8e3b/src/xenia/kernel/util/xex2.cc (L272)
This commit is contained in:
x1nixmzeng
2016-01-09 01:19:05 +00:00
parent 16c97189dd
commit 7e4fdf7669
3 changed files with 9 additions and 5 deletions

View File

@@ -285,7 +285,8 @@ int xe_xex2_read_header(const uint8_t* addr, const size_t length,
library->version.value = src_library->version.value;
library->min_version.value = src_library->version_min.value;
std::strncpy(library->name, string_table[src_library->name_index],
std::strncpy(library->name,
string_table[src_library->name_index % count],
xe::countof(library->name));
library->record_count = src_library->count;