From d084d367e0783377fde0f4778897c4b9cab7bfde Mon Sep 17 00:00:00 2001 From: Gregory Sanders Date: Tue, 25 Sep 2018 14:31:57 -0400 Subject: [PATCH] reject non-hex strings for claim_script --- src/wallet/rpcwallet.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp index 1adae5c678..e844777e18 100644 --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -3586,6 +3586,10 @@ static UniValue createrawpegin(const JSONRPCRequest& request, T_tx_ref& txBTCRef CScript witnessProgScript; unsigned int nOut = txBTC.vout.size(); if (request.params.size() > 2) { + std::string claim_script = ParseHex(request.params[2].get_str()); + if (!IsHex(claim_script)) { + throw JSONRPCError(RPC_INVALID_PARAMETER, "Given claim_script is not hex."); + } // If given manually, no need for it to be a witness script std::vector witnessBytes(ParseHex(request.params[2].get_str())); witnessProgScript = CScript(witnessBytes.begin(), witnessBytes.end());