aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorWladimir J. van der Laan <[email protected]>2017-03-31 10:18:14 +0200
committerWladimir J. van der Laan <[email protected]>2017-03-31 10:21:38 +0200
commitde301b048810c52df3c04bdae6b44a4933016bab (patch)
tree6e7db5cc3ca8c76d23fed23df9ca6a72edf4b99a /src
parentMerge #10090: Update bitcoin.conf with example for pruning (diff)
parentAdd tests for bitcoin-tx input checking (diff)
downloaddiscoin-de301b048810c52df3c04bdae6b44a4933016bab.tar.xz
discoin-de301b048810c52df3c04bdae6b44a4933016bab.zip
Merge #10130: bitcoin-tx input verification (awemany, jnewbery)
19ecd1e Add tests for bitcoin-tx input checking (John Newbery) 21704f6 Check stderr when testing bitcoin-tx (John Newbery) eb66bf9 bitcoin-tx: Fix missing range check (Awemany) Tree-SHA512: 08c6153cf7dd5e0ecd23e24d81af4c0f17534d484179dd91dcd78d42df14c91284341d31cc695469a64c507bce72c34231748b7cabb7df8f1051d228fb0a62c5
Diffstat (limited to 'src')
-rw-r--r--src/bitcoin-tx.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/bitcoin-tx.cpp b/src/bitcoin-tx.cpp
index 61e0eb74e..83b855cbc 100644
--- a/src/bitcoin-tx.cpp
+++ b/src/bitcoin-tx.cpp
@@ -242,6 +242,9 @@ static void MutateTxAddOutAddr(CMutableTransaction& tx, const std::string& strIn
std::vector<std::string> vStrInputParts;
boost::split(vStrInputParts, strInput, boost::is_any_of(":"));
+ if (vStrInputParts.size() != 2)
+ throw std::runtime_error("TX output missing or too many separators");
+
// Extract and validate VALUE
CAmount value = ExtractAndValidateValue(vStrInputParts[0]);
@@ -264,6 +267,9 @@ static void MutateTxAddOutPubKey(CMutableTransaction& tx, const std::string& str
std::vector<std::string> vStrInputParts;
boost::split(vStrInputParts, strInput, boost::is_any_of(":"));
+ if (vStrInputParts.size() < 2 || vStrInputParts.size() > 3)
+ throw std::runtime_error("TX output missing or too many separators");
+
// Extract and validate VALUE
CAmount value = ExtractAndValidateValue(vStrInputParts[0]);