diff options
author | Gavin Andresen <gavinandresen@gmail.com> | 2013-01-23 07:08:55 -0800 |
---|---|---|
committer | Gavin Andresen <gavinandresen@gmail.com> | 2013-01-23 07:08:55 -0800 |
commit | c429f2b062140843f42b78d70278279c6be74441 (patch) | |
tree | 9fafebf5a42b4aa4736fbc1b4cebdc5d5e87ed24 /src | |
parent | 5a4af8f71f527fc7902860aeb0e1b013e0368336 (diff) | |
parent | bffc744444c19e25c60c8df999beb83192f96a8a (diff) |
Merge pull request #2114 from sipa/strictstrict
Make IsCanonicalScript() check the hash type more thoroughly
Diffstat (limited to 'src')
-rw-r--r-- | src/script.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/script.cpp b/src/script.cpp index 45ac8335dc..5e5cd096cd 100644 --- a/src/script.cpp +++ b/src/script.cpp @@ -278,7 +278,8 @@ bool IsCanonicalSignature(const valtype &vchSig) { return error("Non-canonical signature: too short"); if (vchSig.size() > 73) return error("Non-canonical signature: too long"); - if (vchSig[vchSig.size() - 1] & 0x7C) + unsigned char nHashType = vchSig[vchSig.size() - 1] & (~(SIGHASH_ANYONECANPAY)); + if (nHashType < SIGHASH_ALL || nHashType > SIGHASH_SINGLE) return error("Non-canonical signature: unknown hashtype byte"); if (vchSig[0] != 0x30) return error("Non-canonical signature: wrong type"); |