mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-26 12:43:33 +08:00
PX4IO: Fix mixer load corner case in string termination
This commit is contained in:
@@ -533,6 +533,8 @@ mixer_handle_text(const void *buffer, size_t length)
|
|||||||
/* copy any leftover text to the base of the buffer for re-use */
|
/* copy any leftover text to the base of the buffer for re-use */
|
||||||
if (resid > 0) {
|
if (resid > 0) {
|
||||||
memcpy(&mixer_text[0], &mixer_text[mixer_text_length - resid], resid);
|
memcpy(&mixer_text[0], &mixer_text[mixer_text_length - resid], resid);
|
||||||
|
/* enforce null termination */
|
||||||
|
mixer_text[resid] = '\0';
|
||||||
}
|
}
|
||||||
|
|
||||||
mixer_text_length = resid;
|
mixer_text_length = resid;
|
||||||
|
|||||||
Reference in New Issue
Block a user