#12 - Bugfix for out of bounds read.
This commit is contained in:
parent
0680463a15
commit
48c79776d3
|
@ -322,14 +322,20 @@ public:
|
||||||
bool operator()(const CKeyID &keyID) const {
|
bool operator()(const CKeyID &keyID) const {
|
||||||
script->clear();
|
script->clear();
|
||||||
CBlockIndex *currentBlock = chainActive.Tip();
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool operator()(const CScriptID &scriptID) const {
|
bool operator()(const CScriptID &scriptID) const {
|
||||||
script->clear();
|
script->clear();
|
||||||
CBlockIndex *currentBlock = chainActive.Tip();
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue