From e5515e422827f1a3189cf482e272948a334561ae Mon Sep 17 00:00:00 2001 From: Paul-Louis Ageneau Date: Fri, 8 Mar 2024 21:30:00 +0100 Subject: [PATCH] Fix iterator past end of vector --- src/message.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/message.cpp b/src/message.cpp index a0e3c35aa..c2e582a35 100644 --- a/src/message.cpp +++ b/src/message.cpp @@ -31,7 +31,7 @@ message_ptr make_message(size_t size, message_ptr orig) { return nullptr; auto message = std::make_shared(size, orig->type); - std::copy(orig->begin(), std::min(orig->end(), orig->begin() + size), message->begin()); + std::copy(orig->begin(), orig->begin() + std::min(size, orig->size()), message->begin()); message->stream = orig->stream; message->reliability = orig->reliability; return message;