mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-04-16 09:13:50 +00:00
fix: WDT MWMO parser used unbounded strlen on chunk data
std::strlen on raw MWMO chunk data has no upper bound if the chunk
lacks a null terminator (truncated/corrupt WDT file). Replaced with
strnlen bounded by chunkSize, matching the ADT parser fix in d776226f.
This commit is contained in:
parent
7f5cad63cd
commit
a1575ec678
1 changed files with 3 additions and 1 deletions
|
|
@ -69,7 +69,9 @@ WDTInfo parseWDT(const std::vector<uint8_t>& data) {
|
|||
// Null-terminated WMO path string(s)
|
||||
if (chunkSize > 0) {
|
||||
const char* str = reinterpret_cast<const char*>(chunkData);
|
||||
size_t len = std::strlen(str);
|
||||
// Bound scan to chunkSize to avoid OOB read on truncated files
|
||||
// (strlen has no upper bound if the data lacks a null terminator).
|
||||
size_t len = strnlen(str, chunkSize);
|
||||
if (len > 0) {
|
||||
info.rootWMOPath = std::string(str, len);
|
||||
LOG_DEBUG("WDT root WMO: ", info.rootWMOPath);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue