mirror of
https://github.com/espressif/openthread.git
synced 2026-06-06 05:24:51 +00:00
[posix] fix potential buffer overflow in otPlatDiagProcess() (#5478)
This commit is contained in:
@@ -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]);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user