aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPieter Wuille <pieter.wuille@gmail.com>2013-08-25 07:42:21 -0700
committerPieter Wuille <pieter.wuille@gmail.com>2013-08-25 07:42:21 -0700
commit8a9e538227b077b05c93bfec8e5ce1cca0bb366a (patch)
treebb295bf9087686d2389602a299b7829fecce6067 /src
parent3d86e7cd48f8a25a8f1b63a2e8220b56eb1f7b11 (diff)
parent24e5d7d5ae735b41beaaa7ef5feed845607c8280 (diff)
Merge pull request #2935 from sipa/obounds
Fix out-of-bounds check
Diffstat (limited to 'src')
-rw-r--r--src/main.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/main.cpp b/src/main.cpp
index bef578a80a..24fd1fadbc 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -2443,7 +2443,8 @@ bool AcceptBlock(CBlock& block, CValidationState& state, CDiskBlockPos* dbp)
(TestNet() && CBlockIndex::IsSuperMajority(2, pindexPrev, 51, 100)))
{
CScript expect = CScript() << nHeight;
- if (!std::equal(expect.begin(), expect.end(), block.vtx[0].vin[0].scriptSig.begin()))
+ if (block.vtx[0].vin[0].scriptSig.size() < expect.size() ||
+ !std::equal(expect.begin(), expect.end(), block.vtx[0].vin[0].scriptSig.begin()))
return state.DoS(100, error("AcceptBlock() : block height mismatch in coinbase"));
}
}