mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-01-20 07:09:15 +01:00
rpc: Limit echo to 10 args
This commit is contained in:
@@ -583,16 +583,29 @@ static UniValue echo(const JSONRPCRequest& request)
|
||||
throw std::runtime_error(
|
||||
RPCHelpMan{"echo|echojson ...",
|
||||
"\nSimply echo back the input arguments. This command is for testing.\n"
|
||||
"\nIt will return an internal bug report when exactly 100 arguments are passed.\n"
|
||||
"\nIt will return an internal bug report when arg9='trigger_internal_bug' is passed.\n"
|
||||
"\nThe difference between echo and echojson is that echojson has argument conversion enabled in the client-side table in "
|
||||
"bitcoin-cli and the GUI. There is no server-side difference.",
|
||||
{},
|
||||
{
|
||||
{"arg0", RPCArg::Type::STR, RPCArg::Optional::OMITTED_NAMED_ARG, ""},
|
||||
{"arg1", RPCArg::Type::STR, RPCArg::Optional::OMITTED_NAMED_ARG, ""},
|
||||
{"arg2", RPCArg::Type::STR, RPCArg::Optional::OMITTED_NAMED_ARG, ""},
|
||||
{"arg3", RPCArg::Type::STR, RPCArg::Optional::OMITTED_NAMED_ARG, ""},
|
||||
{"arg4", RPCArg::Type::STR, RPCArg::Optional::OMITTED_NAMED_ARG, ""},
|
||||
{"arg5", RPCArg::Type::STR, RPCArg::Optional::OMITTED_NAMED_ARG, ""},
|
||||
{"arg6", RPCArg::Type::STR, RPCArg::Optional::OMITTED_NAMED_ARG, ""},
|
||||
{"arg7", RPCArg::Type::STR, RPCArg::Optional::OMITTED_NAMED_ARG, ""},
|
||||
{"arg8", RPCArg::Type::STR, RPCArg::Optional::OMITTED_NAMED_ARG, ""},
|
||||
{"arg9", RPCArg::Type::STR, RPCArg::Optional::OMITTED_NAMED_ARG, ""},
|
||||
},
|
||||
RPCResult{RPCResult::Type::NONE, "", "Returns whatever was passed in"},
|
||||
RPCExamples{""},
|
||||
}.ToString()
|
||||
);
|
||||
|
||||
CHECK_NONFATAL(request.params.size() != 100);
|
||||
if (request.params[9].isStr()) {
|
||||
CHECK_NONFATAL(request.params[9].get_str() != "trigger_internal_bug");
|
||||
}
|
||||
|
||||
return request.params;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user