aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@gmail.com>2012-10-12 23:49:44 +0200
committerWladimir J. van der Laan <laanwj@gmail.com>2012-10-24 08:26:50 +0200
commit4fbad9124e3a7e644b6226df301ddd73c8395f0b (patch)
tree117e9e11a1c5ea94fcc5a78ca9aa7b3471a363f0 /src
parent675a39fc4f24f9e0c9947e311a39efb6b7261c20 (diff)
Fix out-of-bounds read noticed by Ricardo Correia
Sizeof() returned the size of a pointer instead of the size of the buffer. Fixes issue #1924.
Diffstat (limited to 'src')
-rw-r--r--src/main.cpp5
1 files changed, 1 insertions, 4 deletions
diff --git a/src/main.cpp b/src/main.cpp
index be1e947ad3..e2b2447b84 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -3745,9 +3745,6 @@ public:
}
};
-const char* pszDummy = "\0\0";
-CScript scriptDummy(std::vector<unsigned char>(pszDummy, pszDummy + sizeof(pszDummy)));
-
CBlock* CreateNewBlock(CReserveKey& reservekey)
{
CBlockIndex* pindexPrev = pindexBest;
@@ -3981,7 +3978,7 @@ CBlock* CreateNewBlock(CReserveKey& reservekey)
pblock->UpdateTime(pindexPrev);
pblock->nBits = GetNextWorkRequired(pindexPrev, pblock.get());
pblock->nNonce = 0;
- pblock->vtx[0].vin[0].scriptSig = scriptDummy;
+ pblock->vtx[0].vin[0].scriptSig = CScript() << OP_0 << OP_0;
CBlockIndex indexDummy(*pblock);
indexDummy.pprev = pindexPrev;