From 1a9a2d0880a19b3725af156e536d9493f8bf6b1d Mon Sep 17 00:00:00 2001 From: Pieter Wuille Date: Sat, 24 Aug 2013 23:22:13 +0200 Subject: [PATCH] Fix out-of-bounds check --- src/main.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main.cpp b/src/main.cpp index 972ea3de0..ad4782ff4 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -2202,7 +2202,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")); } }