mirror of https://github.com/ArduPilot/ardupilot
HAL_AVR: fixed null termination of vsnprintf()
This commit is contained in:
parent
4fd3adbcb9
commit
a6b21443c4
|
@ -54,6 +54,10 @@ int AVRUtil::vsnprintf_P(char* str, size_t size, const prog_char_t *format,
|
|||
{
|
||||
BufferPrinter buf(str, size);
|
||||
print_vprintf(&buf, 1,(const char*) format, ap);
|
||||
if (buf._offs < size) {
|
||||
// null terminate if possible
|
||||
str[buf._offs] = 0;
|
||||
}
|
||||
return (int) buf._offs;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue