[Kernel] Don't trust buffer length in XamEnumerate when it matches items per enumerate.

This commit is contained in:
gibbed 2018-11-22 16:49:01 -06:00
parent db234309bf
commit 69463033b1
1 changed files with 4 additions and 3 deletions

View File

@ -198,10 +198,11 @@ dword_result_t XamEnumerate(dword_t handle, dword_t flags, lpvoid_t buffer,
}
}
size_t actual_buffer_length = e->item_size() * e->items_per_enumerate();
if (actual_buffer_length != buffer_length) {
size_t actual_buffer_length = (uint32_t)buffer_length;
if (buffer_length == e->items_per_enumerate()) {
actual_buffer_length = e->item_size() * e->items_per_enumerate();
// Known culprits:
// Final Fight: Double Impact
// Final Fight: Double Impact (saves)
XELOGW(
"Broken usage of XamEnumerate! buffer length=%.X vs actual length=%.X "
"(item size=%.X, items per enumerate=%u)",