AP_Logger: use null terminated strings
this prevents logging garbage for strings that are shorter than the length specifier (eg. 'Z'). This assumes we will not want to log binary data as strings
This commit is contained in:
parent
66c05bef76
commit
4fdf315760
@ -323,7 +323,9 @@ bool AP_Logger_Backend::Write(const uint8_t msg_type, va_list arg_list, bool is_
|
||||
}
|
||||
if (charlen != 0) {
|
||||
char *tmp = va_arg(arg_list, char*);
|
||||
memcpy(&buffer[offset], tmp, charlen);
|
||||
uint8_t len = strnlen(tmp, charlen);
|
||||
memcpy(&buffer[offset], tmp, len);
|
||||
memset(&buffer[offset+len], 0, charlen-len);
|
||||
offset += charlen;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user