[cli] do not pass user-controlled input as format string (#5599)

This commit is contained in:
Jonathan Hui
2020-09-29 21:12:21 -07:00
committed by GitHub
parent 32ffa64902
commit 13d2de89d2
4 changed files with 10 additions and 10 deletions
+5 -5
View File
@@ -337,7 +337,7 @@ otError Interpreter::ProcessHelp(uint8_t aArgsLength, char *aArgs[])
for (uint8_t i = 0; i < mUserCommandsLength; i++)
{
OutputLine(mUserCommands[i].mName);
OutputLine("%s", mUserCommands[i].mName);
}
return OT_ERROR_NONE;
@@ -584,7 +584,7 @@ otError Interpreter::ProcessDomainName(uint8_t aArgsLength, char *aArgs[])
if (aArgsLength == 0)
{
OutputLine(otThreadGetDomainName(mInstance));
OutputLine("%s", otThreadGetDomainName(mInstance));
}
else
{
@@ -2426,7 +2426,7 @@ otError Interpreter::ProcessNetworkName(uint8_t aArgsLength, char *aArgs[])
if (aArgsLength == 0)
{
OutputLine(otThreadGetNetworkName(mInstance));
OutputLine("%s", otThreadGetNetworkName(mInstance));
}
else
{
@@ -3042,7 +3042,7 @@ otError Interpreter::ProcessRcp(uint8_t aArgsLength, char *aArgs[])
if (strcmp(aArgs[0], "version") == 0)
{
OutputLine(version);
OutputLine("%s", version);
}
else
{
@@ -3774,7 +3774,7 @@ otError Interpreter::ProcessVersion(uint8_t aArgsLength, char *aArgs[])
if (aArgsLength == 0)
{
OutputLine(otGetVersionString());
OutputLine("%s", otGetVersionString());
ExitNow();
}
+2 -2
View File
@@ -197,7 +197,7 @@ otError Coap::ProcessResource(uint8_t aArgsLength, char *aArgs[])
}
else
{
mInterpreter.OutputLine(mResource.mUriPath != nullptr ? mResource.mUriPath : "");
mInterpreter.OutputLine("%s", mResource.mUriPath != nullptr ? mResource.mUriPath : "");
}
exit:
@@ -251,7 +251,7 @@ otError Coap::ProcessSet(uint8_t aArgsLength, char *aArgs[])
}
else
{
mInterpreter.OutputLine(mResourceContent);
mInterpreter.OutputLine("%s", mResourceContent);
}
exit:
+2 -2
View File
@@ -130,7 +130,7 @@ otError CoapSecure::ProcessResource(uint8_t aArgsLength, char *aArgs[])
}
else
{
mInterpreter.OutputLine(mResource.mUriPath != nullptr ? mResource.mUriPath : "");
mInterpreter.OutputLine("%s", mResource.mUriPath != nullptr ? mResource.mUriPath : "");
}
exit:
@@ -149,7 +149,7 @@ otError CoapSecure::ProcessSet(uint8_t aArgsLength, char *aArgs[])
}
else
{
mInterpreter.OutputLine(mResourceContent);
mInterpreter.OutputLine("%s", mResourceContent);
}
exit:
+1 -1
View File
@@ -327,7 +327,7 @@ void UdpExample::HandleUdpReceive(otMessage *aMessage, const otMessageInfo *aMes
length = otMessageRead(aMessage, otMessageGetOffset(aMessage), buf, sizeof(buf) - 1);
buf[length] = '\0';
mInterpreter.OutputLine(buf);
mInterpreter.OutputLine("%s", buf);
}
} // namespace Cli