Skip to content

Commit

Permalink
Fix off-by-one error in assertion
Browse files Browse the repository at this point in the history
  • Loading branch information
robomics committed Feb 23, 2025
1 parent 0195a83 commit 9206016
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ inline void BinaryBuffer::read(std::string &buff, std::size_t n) {
inline void BinaryBuffer::read(char *buff, std::size_t n) {
static_assert(sizeof(char) == 1);
const auto size = n * sizeof(char);
assert(_i + size < _buffer.size());
assert(_i + size <= _buffer.size());
// NOLINTNEXTLINE(*-pointer-arithmetic)
std::memcpy(static_cast<void *>(buff), _buffer.data() + _i, size);
_i += size;
Expand Down

0 comments on commit 9206016

Please sign in to comment.