Browse Source

Merge pull request #1926 from laanwj/2012_10_maindummybounds

Fix out-of-bounds read in main (issue #1924)
0.8
Wladimir J. van der Laan 12 years ago
parent
commit
1f7c5c5a3e
  1. 5
      src/main.cpp

5
src/main.cpp

@ -3749,9 +3749,6 @@ public:
} }
}; };
const char* pszDummy = "\0\0";
CScript scriptDummy(std::vector<unsigned char>(pszDummy, pszDummy + sizeof(pszDummy)));
CBlock* CreateNewBlock(CReserveKey& reservekey) CBlock* CreateNewBlock(CReserveKey& reservekey)
{ {
CBlockIndex* pindexPrev = pindexBest; CBlockIndex* pindexPrev = pindexBest;
@ -3985,7 +3982,7 @@ CBlock* CreateNewBlock(CReserveKey& reservekey)
pblock->UpdateTime(pindexPrev); pblock->UpdateTime(pindexPrev);
pblock->nBits = GetNextWorkRequired(pindexPrev, pblock.get()); pblock->nBits = GetNextWorkRequired(pindexPrev, pblock.get());
pblock->nNonce = 0; pblock->nNonce = 0;
pblock->vtx[0].vin[0].scriptSig = scriptDummy; pblock->vtx[0].vin[0].scriptSig = CScript() << OP_0 << OP_0;
CBlockIndex indexDummy(*pblock); CBlockIndex indexDummy(*pblock);
indexDummy.pprev = pindexPrev; indexDummy.pprev = pindexPrev;

Loading…
Cancel
Save