[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:
Robert Quattlebaum
2017-12-03 00:19:41 +00:00
committed by Jonathan Hui
parent ebae34998f
commit 2723a136c9
+6
View File
@@ -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);