Skip to content

Commit

Permalink
fix off by 1 error when bound checking
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisHal committed Dec 6, 2024
1 parent 3d88a9e commit fd3189f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion hekatoolslib/hkTree.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ namespace hkLib {
node.Data = std::span(*pdata, size);
*pdata += size;
std::uint32_t nchildren;
if (*pdata + sizeof(std::uint32_t) >= data_end) throw std::runtime_error("not enough data");
if (*pdata + sizeof(std::uint32_t) > data_end) throw std::runtime_error("not enough data");
std::memcpy(&nchildren, *pdata, sizeof(std::uint32_t));
if (isSwapped) { swapInPlace(nchildren); }
*pdata += sizeof(std::uint32_t);
Expand Down

0 comments on commit fd3189f

Please sign in to comment.