diff options
author | Wladimir J. van der Laan <laanwj@gmail.com> | 2016-11-02 21:03:50 +0100 |
---|---|---|
committer | Wladimir J. van der Laan <laanwj@gmail.com> | 2016-11-02 21:04:20 +0100 |
commit | bc785d71855fbc8bfeb74189a049a7bb29127bb3 (patch) | |
tree | cc362259ab067124a87c437f95f344b088c93edf | |
parent | d316cfeb6e2980abb23a6ff12527b2949b882205 (diff) | |
parent | fa326193ad739d1f93da456b3fa73af0bbf9fdd1 (diff) |
Merge #9042: [rpc] ParseHash: Fail when length is not 64
fa32619 [rpc] ParseHash: Fail when length is not 64 (MarcoFalke)
-rw-r--r-- | src/rpc/server.cpp | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/rpc/server.cpp b/src/rpc/server.cpp index 29d0bee1b2..164e0f00e2 100644 --- a/src/rpc/server.cpp +++ b/src/rpc/server.cpp @@ -147,6 +147,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; |