mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-01-09 09:28:31 -04:00
HAL_SITL: ensure that unique id string end in null char
This commit is contained in:
parent
c4fa6fee9a
commit
9d7022514e
@ -39,6 +39,11 @@ bool HALSITL::Util::get_system_id_unformatted(uint8_t buf[], uint8_t &len)
|
|||||||
if (ret <= 0) {
|
if (ret <= 0) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
if (ret == len) {
|
||||||
|
cbuf[len-1] = '\0';
|
||||||
|
} else {
|
||||||
|
cbuf[ret] = '\0';
|
||||||
|
}
|
||||||
len = ret;
|
len = ret;
|
||||||
char *p = strchr(cbuf, '\n');
|
char *p = strchr(cbuf, '\n');
|
||||||
if (p) {
|
if (p) {
|
||||||
|
Loading…
Reference in New Issue
Block a user