From b47dc3f77c12b7bcaf2e42159c04dd56ebb0a682 Mon Sep 17 00:00:00 2001 From: Matias Fontanini Date: Wed, 10 May 2017 19:13:45 -0700 Subject: [PATCH] Only call memcpy in PDUOption if size > 0 --- include/tins/pdu_option.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/include/tins/pdu_option.h b/include/tins/pdu_option.h index 6e950c9..0f435c1 100644 --- a/include/tins/pdu_option.h +++ b/include/tins/pdu_option.h @@ -515,7 +515,9 @@ private: } real_size_ = static_cast(total_size); if (real_size_ <= small_buffer_size) { - std::memcpy(payload_.small_buffer, &*start, total_size); + if (total_size > 0) { + std::memcpy(payload_.small_buffer, &*start, total_size); + } } else { payload_.big_buffer_ptr = new data_type[real_size_];