From d54f04d50c138f8ef3c874b48e5ea003c4311145 Mon Sep 17 00:00:00 2001 From: Lee *!* Clagett Date: Tue, 19 Nov 2024 18:51:52 -0500 Subject: [PATCH] Fix memcpy in byte_slice constructor --- contrib/epee/src/byte_slice.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contrib/epee/src/byte_slice.cpp b/contrib/epee/src/byte_slice.cpp index ebe3f1d703..c56f006e9d 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 }