mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-30 16:45:33 +00:00
parent
e350d7d4ff
commit
47ced7dec4
1 changed files with 8 additions and 0 deletions
|
@ -168,6 +168,14 @@ void BSAFile::readHeader()
|
||||||
fs.setNameInfos(namesOffset, &mStringBuf);
|
fs.setNameInfos(namesOffset, &mStringBuf);
|
||||||
fs.hash = hashes[i];
|
fs.hash = hashes[i];
|
||||||
|
|
||||||
|
if (namesOffset >= mStringBuf.size()) {
|
||||||
|
fail("Archive contains names offset outside itself");
|
||||||
|
}
|
||||||
|
const void* end = std::memchr(fs.name(), '\0', mStringBuf.size()-namesOffset);
|
||||||
|
if (!end) {
|
||||||
|
fail("Archive contains non-zero terminated string");
|
||||||
|
}
|
||||||
|
|
||||||
endOfNameBuffer = std::max(endOfNameBuffer, namesOffset + std::strlen(fs.name())+1);
|
endOfNameBuffer = std::max(endOfNameBuffer, namesOffset + std::strlen(fs.name())+1);
|
||||||
assert(endOfNameBuffer <= mStringBuf.size());
|
assert(endOfNameBuffer <= mStringBuf.size());
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue