mirror of
https://github.com/espressif/openthread.git
synced 2026-08-07 19:27:46 +00:00
[message] adjust offset when cloning a message subset (#3944)
This commit is contained in:
@@ -637,6 +637,7 @@ Message *Message::Clone(uint16_t aLength) const
|
||||
{
|
||||
otError error = OT_ERROR_NONE;
|
||||
Message *messageCopy;
|
||||
uint16_t offset;
|
||||
|
||||
VerifyOrExit((messageCopy = GetMessagePool()->New(GetType(), GetReserved(), GetPriority())) != NULL,
|
||||
error = OT_ERROR_NO_BUFS);
|
||||
@@ -644,7 +645,9 @@ Message *Message::Clone(uint16_t aLength) const
|
||||
CopyTo(0, 0, aLength, *messageCopy);
|
||||
|
||||
// Copy selected message information.
|
||||
messageCopy->SetOffset(GetOffset());
|
||||
offset = GetOffset() < aLength ? GetOffset() : aLength;
|
||||
messageCopy->SetOffset(offset);
|
||||
|
||||
messageCopy->SetSubType(GetSubType());
|
||||
messageCopy->SetLinkSecurityEnabled(IsLinkSecurityEnabled());
|
||||
#if OPENTHREAD_CONFIG_ENABLE_TIME_SYNC
|
||||
|
||||
Reference in New Issue
Block a user