diff --git a/contrib/epee/src/byte_slice.cpp b/contrib/epee/src/byte_slice.cpp index ebe3f1d70..c56f006e9 100644 --- a/contrib/epee/src/byte_slice.cpp +++ b/contrib/epee/src/byte_slice.cpp @@ -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 }