mirror of
https://github.com/XRPLF/rippled.git
synced 2025-11-21 03:26:01 +00:00
Better parameter checking for RPC subscribe books.
This commit is contained in:
@@ -2757,6 +2757,14 @@ Json::Value RPCHandler::doSubscribe(Json::Value jvRequest, int& cost)
|
|||||||
for (Json::Value::iterator it = jvRequest["books"].begin(); it != jvRequest["books"].end(); it++)
|
for (Json::Value::iterator it = jvRequest["books"].begin(); it != jvRequest["books"].end(); it++)
|
||||||
{
|
{
|
||||||
Json::Value& jvSubRequest = *it;
|
Json::Value& jvSubRequest = *it;
|
||||||
|
|
||||||
|
if (!jvSubRequest.isObject()
|
||||||
|
|| !jvSubRequest.isMember("taker_pays")
|
||||||
|
|| !jvSubRequest.isMember("taker_gets")
|
||||||
|
|| !jvSubRequest["taker_pays"].isObject()
|
||||||
|
|| !jvSubRequest["taker_gets"].isObject())
|
||||||
|
return rpcError(rpcINVALID_PARAMS);
|
||||||
|
|
||||||
uint160 uTakerPaysCurrencyID;
|
uint160 uTakerPaysCurrencyID;
|
||||||
uint160 uTakerPaysIssuerID;
|
uint160 uTakerPaysIssuerID;
|
||||||
uint160 uTakerGetsCurrencyID;
|
uint160 uTakerGetsCurrencyID;
|
||||||
@@ -2766,10 +2774,6 @@ Json::Value RPCHandler::doSubscribe(Json::Value jvRequest, int& cost)
|
|||||||
bool bSnapshot = (jvSubRequest.isMember("snapshot") && jvSubRequest["snapshot"].asBool())
|
bool bSnapshot = (jvSubRequest.isMember("snapshot") && jvSubRequest["snapshot"].asBool())
|
||||||
|| (jvSubRequest.isMember("start_now") && jvSubRequest["start_now"].asBool()); // DEPRECATED
|
|| (jvSubRequest.isMember("start_now") && jvSubRequest["start_now"].asBool()); // DEPRECATED
|
||||||
|
|
||||||
|
|
||||||
if (!jvSubRequest.isMember("taker_pays") || !jvSubRequest.isMember("taker_gets"))
|
|
||||||
return rpcError(rpcINVALID_PARAMS);
|
|
||||||
|
|
||||||
Json::Value jvTakerPays = jvSubRequest["taker_pays"];
|
Json::Value jvTakerPays = jvSubRequest["taker_pays"];
|
||||||
Json::Value jvTakerGets = jvSubRequest["taker_gets"];
|
Json::Value jvTakerGets = jvSubRequest["taker_gets"];
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user