mirror of
https://github.com/espressif/openthread.git
synced 2026-07-28 22:57:47 +00:00
[posix] fix strncpy warning about null terminated string length (#6698)
This commit is contained in:
@@ -52,8 +52,9 @@ void platformBackboneInit(otInstance *aInstance, const char *aInterfaceName)
|
||||
|
||||
VerifyOrExit(aInterfaceName != nullptr && aInterfaceName[0] != '\0');
|
||||
|
||||
VerifyOrDie(strnlen(aInterfaceName, IFNAMSIZ) <= IFNAMSIZ - 1, OT_EXIT_INVALID_ARGUMENTS);
|
||||
strncpy(gBackboneNetifName, aInterfaceName, sizeof(gBackboneNetifName));
|
||||
VerifyOrDie(strnlen(aInterfaceName, sizeof(gBackboneNetifName)) < sizeof(gBackboneNetifName),
|
||||
OT_EXIT_INVALID_ARGUMENTS);
|
||||
strcpy(gBackboneNetifName, aInterfaceName);
|
||||
|
||||
gBackboneNetifIndex = if_nametoindex(gBackboneNetifName);
|
||||
VerifyOrDie(gBackboneNetifIndex > 0, OT_EXIT_FAILURE);
|
||||
|
||||
Reference in New Issue
Block a user