Summary Files Commits Branches @commit @diff @stats
path: root / src / message.cpp
diff options
context:
space:
mode:
1 files changed, 3 insertions, 0 deletions
-rw-r--r--src/message.cpp3
diff --git a/src/message.cpp b/src/message.cpp
index ee1d8fe..834fd87 100644
--- a/src/message.cpp
+++ b/src/message.cpp
@@ -41,7 +41,10 @@ Message& Message::operator=(const Message& other) {
}
void Message::receive_frame(const Frame& f) {
+ // For CFs we set the data size to 7 (the maximum), however, we may be expecting
+ // to receive less data (in the last CF).
size_t expects = std::min(this->size - this->received, f.get_data_size());
+
std::memcpy(this->msg + this->received, f.get_data(), expects);
this->received += expects;
}