mirror of
https://github.com/wiiu-env/WUMSLoader.git
synced 2024-11-13 03:35:07 +01:00
Add additional check to make sure to not overflow buffer
This commit is contained in:
parent
482121907a
commit
90d4ccfe2a
@ -131,6 +131,11 @@ std::optional<std::shared_ptr<ModuleData>> ModuleDataFactory::load(const std::st
|
||||
|
||||
const char *p = reader.sections[i]->get_data();
|
||||
|
||||
if (destination + sectionSize > (uint32_t) data.get() + text_size + data_size) {
|
||||
DEBUG_FUNCTION_LINE_ERR("Tried to overflow buffer. %08X > %08X", destination + sectionSize, (uint32_t) data.get() + text_size + data_size);
|
||||
OSFatal("WUMSLoader: Tried to overflow buffer");
|
||||
}
|
||||
|
||||
if (psec->get_type() == SHT_NOBITS) {
|
||||
DEBUG_FUNCTION_LINE("memset section %s %08X to 0 (%d bytes)", psec->get_name().c_str(), destination, sectionSize);
|
||||
memset((void *) destination, 0, sectionSize);
|
||||
|
Loading…
Reference in New Issue
Block a user