aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPieter Wuille <pieter.wuille@gmail.com>2013-08-24 23:22:13 +0200
committerGavin Andresen <gavinandresen@gmail.com>2013-09-12 12:41:17 +1000
commit27fefeac7151fe362e9a5c059a9c70f909e602fb (patch)
tree2594804e41754d3fffbb7a7f1f75b9dc8e2e2e4b
parentf0a1d87b00e666a7028c2b517d786bc7511eaf5d (diff)
downloadbitcoin-27fefeac7151fe362e9a5c059a9c70f909e602fb.tar.xz
Fix out-of-bounds check
-rw-r--r--src/main.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/main.cpp b/src/main.cpp
index a7501a1b68..ce45133a9f 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -2191,7 +2191,8 @@ bool CBlock::AcceptBlock(CValidationState &state, CDiskBlockPos *dbp)
(fTestNet && CBlockIndex::IsSuperMajority(2, pindexPrev, 51, 100)))
{
CScript expect = CScript() << nHeight;
- if (!std::equal(expect.begin(), expect.end(), vtx[0].vin[0].scriptSig.begin()))
+ if (vtx[0].vin[0].scriptSig.size() < expect.size() ||
+ !std::equal(expect.begin(), expect.end(), vtx[0].vin[0].scriptSig.begin()))
return state.DoS(100, error("AcceptBlock() : block height mismatch in coinbase"));
}
}