aboutsummaryrefslogtreecommitdiff
path: root/src/script.cpp
diff options
context:
space:
mode:
authorPieter Wuille <pieter.wuille@gmail.com>2012-12-19 01:24:00 +0100
committerPieter Wuille <pieter.wuille@gmail.com>2012-12-22 18:39:36 +0100
commitbffc744444c19e25c60c8df999beb83192f96a8a (patch)
tree1312c6e3b6c6209487b59a1d55469dddd1c59fc0 /src/script.cpp
parent23826f1b7fd070894cfabdbf49b0a3840e6f33a6 (diff)
Make IsCanonicalScript() check the hash type more thoroughly
0 and 128 were previously accepted as standard hash type. Note that this function is not active in the current verification code.
Diffstat (limited to 'src/script.cpp')
-rw-r--r--src/script.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/script.cpp b/src/script.cpp
index f65508aacc..f63668ac59 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");