diff options
| author | Jonas Schnelli <[email protected]> | 2016-06-08 15:34:25 +0200 |
|---|---|---|
| committer | Jonas Schnelli <[email protected]> | 2016-06-08 15:43:28 +0200 |
| commit | 6fa950a57334e93e70d806532ee517cbd75a2338 (patch) | |
| tree | 9a15b57f8c29ba284504d56cd4c6bbf67c59b134 /src/rpc/rawtransaction.cpp | |
| parent | Merge #7993: [depends] Bump Freetype, ccache, ZeroMQ, miniupnpc, expat (diff) | |
| download | discoin-6fa950a57334e93e70d806532ee517cbd75a2338.tar.xz discoin-6fa950a57334e93e70d806532ee517cbd75a2338.zip | |
[RPC] Fix createrawtx sequence number unsigned int parsing
Diffstat (limited to 'src/rpc/rawtransaction.cpp')
| -rw-r--r-- | src/rpc/rawtransaction.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/rpc/rawtransaction.cpp b/src/rpc/rawtransaction.cpp index 992914f88..9723e394d 100644 --- a/src/rpc/rawtransaction.cpp +++ b/src/rpc/rawtransaction.cpp @@ -388,8 +388,13 @@ UniValue createrawtransaction(const UniValue& params, bool fHelp) // set the sequence number if passed in the parameters object const UniValue& sequenceObj = find_value(o, "sequence"); - if (sequenceObj.isNum()) - nSequence = sequenceObj.get_int(); + if (sequenceObj.isNum()) { + int64_t seqNr64 = sequenceObj.get_int64(); + if (seqNr64 < 0 || seqNr64 > std::numeric_limits<uint32_t>::max()) + throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid parameter, sequence number is out of range"); + else + nSequence = (uint32_t)seqNr64; + } CTxIn in(COutPoint(txid, nOutput), CScript(), nSequence); |