Skip to content

Commit

Permalink
Fix memcpy in byte_slice constructor
Browse files Browse the repository at this point in the history
  • Loading branch information
vtnerd committed Nov 19, 2024
1 parent 58a1d54 commit 36c7315
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion contrib/epee/src/byte_slice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ namespace epee

for (const auto& source : sources)
{
std::memcpy(out.data(), source.data(), source.size());
std::memcpy(out.data(), source.data(), std::min(out.size(), source.size()));
if (out.remove_prefix(source.size()) < source.size())
throw std::bad_alloc{}; // size_t overflow on space_needed
}
Expand Down

0 comments on commit 36c7315

Please sign in to comment.