mirror of
https://github.com/espressif/openthread.git
synced 2026-07-27 22:37:45 +00:00
[cli] do not pass user-controlled input as format string (#5599)
This commit is contained in:
+5
-5
@@ -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();
|
||||
}
|
||||
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user