[posix] fix potential buffer overflow in otPlatDiagProcess() (#5478)

This commit is contained in:
Jonathan Hui
2020-08-31 08:27:01 -07:00
committed by GitHub
parent 631e9ba0b8
commit ec3a9f87a7
+1 -1
View File
@@ -403,7 +403,7 @@ otError otPlatDiagProcess(otInstance *aInstance,
char *cur = cmd;
char *end = cmd + sizeof(cmd);
for (uint8_t index = 0; index < aArgsLength; index++)
for (uint8_t index = 0; (index < aArgsLength) && (cur < end); index++)
{
cur += snprintf(cur, static_cast<size_t>(end - cur), "%s ", aArgs[index]);
}