mirror of
https://github.com/espressif/openthread.git
synced 2026-09-16 14:10:09 +00:00
[nrf52480] Fix for buffer overrun in otPlatLog (#2384)
This commit addresses a misunderstanding of what the return value of `vsnprintf()` means. This fixes issue #2382.
This commit is contained in:
committed by
Jonathan Hui
parent
ebae34998f
commit
2723a136c9
@@ -167,6 +167,12 @@ void otPlatLog(otLogLevel aLogLevel, otLogRegion aLogRegion,
|
||||
va_start(paramList, aFormat);
|
||||
length += vsnprintf(&logString[length], (LOG_PARSE_BUFFER_SIZE - length),
|
||||
aFormat, paramList);
|
||||
|
||||
if (length > LOG_PARSE_BUFFER_SIZE)
|
||||
{
|
||||
length = LOG_PARSE_BUFFER_SIZE;
|
||||
}
|
||||
|
||||
logString[length++] = '\n';
|
||||
va_end(paramList);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user