Ensure that Network Name strings are NULL-termianted for client code. (#368)

* otGetNetworkName() no longer returns a pointer into a beacon message.
* Scan results no longer point into a beacon message.
This commit is contained in:
Jonathan Hui
2016-08-12 11:07:09 -07:00
committed by GitHub
parent 7d9b65e7a1
commit 8252cd6277
9 changed files with 51 additions and 54 deletions
+5 -19
View File
@@ -883,7 +883,7 @@ void Interpreter::ProcessNetworkName(int argc, char *argv[])
if (argc == 0)
{
sServer->OutputFormat("%.*s\r\n", OT_NETWORK_NAME_SIZE, otGetNetworkName());
sServer->OutputFormat("%.*s\r\n", OT_NETWORK_NAME_MAX_SIZE, otGetNetworkName());
}
else
{
@@ -1456,25 +1456,11 @@ void Interpreter::HandleActiveScanResult(otActiveScanResult *aResult)
sServer->OutputFormat("| %d ", aResult->mIsJoinable);
if (aResult->mNetworkName != NULL)
{
sServer->OutputFormat("| %-16s ", aResult->mNetworkName);
}
else
{
sServer->OutputFormat("| ---------------- ");
}
sServer->OutputFormat("| %-16s ", aResult->mNetworkName.m8);
if (aResult->mExtPanId != NULL)
{
sServer->OutputFormat("| ");
OutputBytes(aResult->mExtPanId, OT_EXT_PAN_ID_SIZE);
sServer->OutputFormat(" ");
}
else
{
sServer->OutputFormat("| ---------------- ");
}
sServer->OutputFormat("| ");
OutputBytes(aResult->mExtendedPanId.m8, OT_EXT_PAN_ID_SIZE);
sServer->OutputFormat(" ");
sServer->OutputFormat("| %04x | ", aResult->mPanId);
OutputBytes(aResult->mExtAddress.m8, OT_EXT_ADDRESS_SIZE);