From ff12a962bfca3a2956d5b4d5405f9ec0e2508db0 Mon Sep 17 00:00:00 2001 From: Alexander Gehres Date: Sun, 1 Apr 2018 22:37:30 +0200 Subject: [PATCH] fix setruntimeparam for autosubscribe when you call: {"method": "setruntimeparam", "params": ["autosubscribe", "something"]} there will be no error and when you call: {"method": "getruntimeparams", "params": []} it will return the line: "autosubscribe": "something", So you are able to set an invalid parameter --- src/rpc/rpcmisc.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/rpc/rpcmisc.cpp b/src/rpc/rpcmisc.cpp index b7f4ca98..3a826e0f 100644 --- a/src/rpc/rpcmisc.cpp +++ b/src/rpc/rpcmisc.cpp @@ -477,16 +477,16 @@ Value setruntimeparam(const json_spirit::Array& params, bool fHelp) if(autosubscribe=="streams") { mode |= MC_WMD_AUTOSUBSCRIBE_STREAMS; - } - if(autosubscribe=="assets") + } else if (autosubscribe=="assets") { mode |= MC_WMD_AUTOSUBSCRIBE_ASSETS; - } - if( (autosubscribe=="assets,streams") || (autosubscribe=="streams,assets")) + } else if ( (autosubscribe=="assets,streams") || (autosubscribe=="streams,assets")) { mode |= MC_WMD_AUTOSUBSCRIBE_STREAMS; mode |= MC_WMD_AUTOSUBSCRIBE_ASSETS; - } + } else { + throw JSONRPCError(RPC_INVALID_PARAMETER, "Should be 'assets', 'streams' or 'assets,streams'"); + } if(pwalletTxsMain) {