aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@gmail.com>2017-02-06 14:35:44 +0100
committerWladimir J. van der Laan <laanwj@gmail.com>2017-02-06 14:51:00 +0100
commit40f7e27d25ff74f023371ba607f727375581cb7a (patch)
tree233ed140671895319bb9a0eb019e6f5475514e78 /src
parent09e0c28f8566d9614084e5f52739f6241d80685a (diff)
parent6dbfe08c29535bb7b0359de8fe22acedcbf3532a (diff)
Merge #9650: Better handle invalid parameters to signrawtransaction
6dbfe08 [qa] test signrawtransaction merge with missing inputs (Matt Corallo) ec4f7e4 [qa] Add second input to signrawtransaction test case (Matt Corallo) 691710a [qa] Test that decoderawtransaction throws with extra data appended (Matt Corallo) 922bea9 Better handle invalid parameters to signrawtransaction (Matt Corallo) 7ea0ad5 Fail in DecodeHexTx if there is extra data at the end (Matt Corallo)
Diffstat (limited to 'src')
-rw-r--r--src/core_read.cpp2
-rw-r--r--src/rpc/rawtransaction.cpp4
2 files changed, 5 insertions, 1 deletions
diff --git a/src/core_read.cpp b/src/core_read.cpp
index a5f232c228..a8d667e3bc 100644
--- a/src/core_read.cpp
+++ b/src/core_read.cpp
@@ -111,6 +111,8 @@ bool DecodeHexTx(CMutableTransaction& tx, const std::string& strHexTx, bool fTry
CDataStream ssData(txData, SER_NETWORK, PROTOCOL_VERSION);
try {
ssData >> tx;
+ if (!ssData.empty())
+ return false;
}
catch (const std::exception&) {
return false;
diff --git a/src/rpc/rawtransaction.cpp b/src/rpc/rawtransaction.cpp
index c10de45f8b..21396ebb09 100644
--- a/src/rpc/rawtransaction.cpp
+++ b/src/rpc/rawtransaction.cpp
@@ -835,7 +835,9 @@ UniValue signrawtransaction(const JSONRPCRequest& request)
// ... and merge in other signatures:
BOOST_FOREACH(const CMutableTransaction& txv, txVariants) {
- sigdata = CombineSignatures(prevPubKey, TransactionSignatureChecker(&txConst, i, amount), sigdata, DataFromTransaction(txv, i));
+ if (txv.vin.size() > i) {
+ sigdata = CombineSignatures(prevPubKey, TransactionSignatureChecker(&txConst, i, amount), sigdata, DataFromTransaction(txv, i));
+ }
}
UpdateTransaction(mergedTx, i, sigdata);