[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(); size_t actual_buffer_length = (uint32_t)buffer_length;
if (actual_buffer_length != buffer_length) { if (buffer_length == e->items_per_enumerate()) {
actual_buffer_length = e->item_size() * e->items_per_enumerate();
// Known culprits: // Known culprits:
// Final Fight: Double Impact // Final Fight: Double Impact (saves)
XELOGW( XELOGW(
"Broken usage of XamEnumerate! buffer length=%.X vs actual length=%.X " "Broken usage of XamEnumerate! buffer length=%.X vs actual length=%.X "
"(item size=%.X, items per enumerate=%u)", "(item size=%.X, items per enumerate=%u)",