Validate params before dispatching

This commit is contained in:
JoelKatz
2014-02-21 10:18:12 -08:00
committed by Vinnie Falco
parent c186519bcf
commit 652d809129

View File

@@ -116,6 +116,9 @@ std::string RPCServerHandler::processRequest (std::string const& request, IP::En
{ {
Json::Value ripple_params (params.size() Json::Value ripple_params (params.size()
? params [0u] : Json::Value (Json::objectValue)); ? params [0u] : Json::Value (Json::objectValue));
if (!ripple_params.isObject())
return HTTPReply (400, "params must be an object");
ripple_params ["command"] = strMethod; ripple_params ["command"] = strMethod;
RPC::Request req (LogPartition::getJournal <RPCServer> (), RPC::Request req (LogPartition::getJournal <RPCServer> (),
strMethod, ripple_params, getApp ()); strMethod, ripple_params, getApp ());