HAL_SITL: ensure that unique id string end in null char

This commit is contained in:
bugobliterator 2020-04-03 16:50:02 +05:30 committed by Andrew Tridgell
parent c4fa6fee9a
commit 9d7022514e
1 changed files with 5 additions and 0 deletions

View File

@ -39,6 +39,11 @@ bool HALSITL::Util::get_system_id_unformatted(uint8_t buf[], uint8_t &len)
if (ret <= 0) {
continue;
}
if (ret == len) {
cbuf[len-1] = '\0';
} else {
cbuf[ret] = '\0';
}
len = ret;
char *p = strchr(cbuf, '\n');
if (p) {