aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcoFalke <falke.marco@gmail.com>2016-10-30 16:58:13 +0100
committerLuke Dashjr <luke-jr+git@utopios.org>2016-12-02 07:41:11 +0000
commit5bcb05d4e1304ac3582f1779a25693c0065c69e9 (patch)
tree9b5fb2743a1632fcd31ea5d705d58ba624359b78
parent973ca1e4912e7ad85e0d06e9490c5939232de6a4 (diff)
downloadbitcoin-5bcb05d4e1304ac3582f1779a25693c0065c69e9.tar.xz
[rpc] ParseHash: Fail when length is not 64
Github-Pull: #9042 Rebased-From: fa326193ad739d1f93da456b3fa73af0bbf9fdd1
-rw-r--r--src/rpc/server.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/rpc/server.cpp b/src/rpc/server.cpp
index 23149baa6d..102c776314 100644
--- a/src/rpc/server.cpp
+++ b/src/rpc/server.cpp
@@ -146,6 +146,8 @@ uint256 ParseHashV(const UniValue& v, string strName)
strHex = v.get_str();
if (!IsHex(strHex)) // Note: IsHex("") is false
throw JSONRPCError(RPC_INVALID_PARAMETER, strName+" must be hexadecimal string (not '"+strHex+"')");
+ if (64 != strHex.length())
+ throw JSONRPCError(RPC_INVALID_PARAMETER, strprintf("%s must be of length %d (not %d)", strName, 64, strHex.length()));
uint256 result;
result.SetHex(strHex);
return result;