aboutsummaryrefslogtreecommitdiff
path: root/src/script
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@gmail.com>2014-10-07 08:38:40 +0200
committerWladimir J. van der Laan <laanwj@gmail.com>2014-10-07 08:51:20 +0200
commit953f16cb4e17aef8223d74a578d1fd064b2a34b6 (patch)
tree6043f970485404fdd5de69489a46eafba9423ce9 /src/script
parenta2a5fe3b727bcf5f87b91f5b625c98e132fd3d22 (diff)
parent9d7cd4c598edfff12f1f80629c9149b3f1cf75a6 (diff)
Merge pull request #4954
9d7cd4c Don't return an address for invalid pubkeys (Andy Alness)
Diffstat (limited to 'src/script')
-rw-r--r--src/script/standard.cpp15
1 files changed, 13 insertions, 2 deletions
diff --git a/src/script/standard.cpp b/src/script/standard.cpp
index 407baf621d..53ae254d59 100644
--- a/src/script/standard.cpp
+++ b/src/script/standard.cpp
@@ -203,7 +203,11 @@ bool ExtractDestination(const CScript& scriptPubKey, CTxDestination& addressRet)
if (whichType == TX_PUBKEY)
{
- addressRet = CPubKey(vSolutions[0]).GetID();
+ CPubKey pubKey(vSolutions[0]);
+ if (!pubKey.IsValid())
+ return false;
+
+ addressRet = pubKey.GetID();
return true;
}
else if (whichType == TX_PUBKEYHASH)
@@ -237,9 +241,16 @@ bool ExtractDestinations(const CScript& scriptPubKey, txnouttype& typeRet, vecto
nRequiredRet = vSolutions.front()[0];
for (unsigned int i = 1; i < vSolutions.size()-1; i++)
{
- CTxDestination address = CPubKey(vSolutions[i]).GetID();
+ CPubKey pubKey(vSolutions[i]);
+ if (!pubKey.IsValid())
+ continue;
+
+ CTxDestination address = pubKey.GetID();
addressRet.push_back(address);
}
+
+ if (addressRet.empty())
+ return false;
}
else
{