[posix] allow empty backbone interface name (#6685)

Add the empty string check for backbone interface.
This commit is contained in:
Xinyuan (Amy)
2021-05-26 13:25:49 -07:00
committed by GitHub
parent 71e6543d9b
commit a2247da59d
2 changed files with 2 additions and 2 deletions
+1 -1
View File
@@ -50,7 +50,7 @@ void platformBackboneInit(otInstance *aInstance, const char *aInterfaceName)
{
OT_UNUSED_VARIABLE(aInstance);
VerifyOrExit(aInterfaceName != nullptr);
VerifyOrExit(aInterfaceName != nullptr && aInterfaceName[0] != '\0');
VerifyOrDie(strnlen(aInterfaceName, IFNAMSIZ) <= IFNAMSIZ - 1, OT_EXIT_INVALID_ARGUMENTS);
strncpy(gBackboneNetifName, aInterfaceName, sizeof(gBackboneNetifName));
+1 -1
View File
@@ -273,7 +273,7 @@ void InfraNetif::Init(otInstance *aInstance, const char *aIfName)
ssize_t rval;
uint32_t ifIndex = 0;
VerifyOrExit(aIfName != nullptr);
VerifyOrExit(aIfName != nullptr && aIfName[0] != '\0');
VerifyOrDie(strnlen(aIfName, sizeof(mInfraIfName)) <= sizeof(mInfraIfName) - 1, OT_EXIT_INVALID_ARGUMENTS);
strcpy(mInfraIfName, aIfName);