#12 - Bugfix for out of bounds read.

This commit is contained in:
joshuayabut 2017-05-07 01:03:19 -04:00
parent 0680463a15
commit 48c79776d3
1 changed files with 8 additions and 2 deletions

View File

@ -322,14 +322,20 @@ public:
bool operator()(const CKeyID &keyID) const {
script->clear();
CBlockIndex *currentBlock = chainActive.Tip();
*script << OP_DUP << OP_HASH160 << ToByteVector(keyID) << OP_EQUALVERIFY << OP_CHECKSIG << ToByteVector(chainActive[currentBlock->nHeight - 300]->GetBlockHash()) << chainActive[currentBlock->nHeight - 300]->nHeight << OP_CHECKBLOCKATHEIGHT;
int blockIndex = currentBlock->nHeight - 300;
if (blockIndex < 0)
blockIndex = 0;
*script << OP_DUP << OP_HASH160 << ToByteVector(keyID) << OP_EQUALVERIFY << OP_CHECKSIG << ToByteVector(chainActive[blockIndex]->GetBlockHash()) << chainActive[blockIndex]->nHeight << OP_CHECKBLOCKATHEIGHT;
return true;
}
bool operator()(const CScriptID &scriptID) const {
script->clear();
CBlockIndex *currentBlock = chainActive.Tip();
*script << OP_HASH160 << ToByteVector(scriptID) << OP_EQUAL << ToByteVector(chainActive[currentBlock->nHeight - 300]->GetBlockHash()) << chainActive[currentBlock->nHeight - 300]->nHeight << OP_CHECKBLOCKATHEIGHT;
int blockIndex = currentBlock->nHeight - 300;
if (blockIndex < 0)
blockIndex = 0;
*script << OP_HASH160 << ToByteVector(scriptID) << OP_EQUAL << ToByteVector(chainActive[blockIndex]->GetBlockHash()) << chainActive[blockIndex]->nHeight << OP_CHECKBLOCKATHEIGHT;
return true;
}
#endif