From: alex Date: Tue, 27 Aug 2013 19:51:11 +0000 (+0400) Subject: Fix coinbase out-of-bounds check X-Git-Tag: v0.4.4.4~11 X-Git-Url: https://git.novaco.in/?p=novacoin.git;a=commitdiff_plain;h=b689daa957b87cd31b91ce7181e01ae722da6095;hp=85684d561fff0c83f57c4870af01a877c572d59c Fix coinbase out-of-bounds check --- diff --git a/src/main.cpp b/src/main.cpp index 9a3dca1..332832e 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -2262,7 +2262,8 @@ bool CBlock::AcceptBlock() // Enforce rule that the coinbase starts with serialized block height 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 DoS(100, error("AcceptBlock() : block height mismatch in coinbase")); // Write block to history file