diff --git a/include/ascs/ext/unpacker.h b/include/ascs/ext/unpacker.h index b1b4cc3269c728b145b7ef926288d365a10cf2c0..e745e60015548fc848bedd4bbb1caf1942545e36 100644 --- a/include/ascs/ext/unpacker.h +++ b/include/ascs/ext/unpacker.h @@ -81,7 +81,7 @@ public: if (unpack_ok && remain_len > 0) { auto pnext = std::next(msg_pos_can.back().first, msg_pos_can.back().second); - memcpy(&*std::begin(raw_buff), pnext, remain_len); //left behind unparsed data + memmove(&*std::begin(raw_buff), pnext, remain_len); //left behind unparsed data } //if unpacking failed, successfully parsed msgs will still returned via msg_can(sticky package), please note. @@ -405,7 +405,7 @@ public: if (pnext == &*std::begin(raw_buff)) //we should have at least got one msg. return false; else if (remain_len > 0) - memcpy(&*std::begin(raw_buff), pnext, remain_len); //left behind unparsed msg + memmove(&*std::begin(raw_buff), pnext, remain_len); //left behind unparsed msg return true; }