diff options
| author | Wladimir J. van der Laan <[email protected]> | 2012-10-12 23:49:44 +0200 |
|---|---|---|
| committer | Luke Dashjr <[email protected]> | 2012-11-12 22:28:47 +0000 |
| commit | 3e72516398298e205712fbcf307c45765c969949 (patch) | |
| tree | d2e5f68fc2a7d084557c4ced60a55c1342697c08 /src | |
| parent | CAddrMan: verify pchMessageStart file marker, before reading address data (diff) | |
| download | discoin-3e72516398298e205712fbcf307c45765c969949.tar.xz discoin-3e72516398298e205712fbcf307c45765c969949.zip | |
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.cpp | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/src/main.cpp b/src/main.cpp index 28bf01a8c..0524e7f83 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -3458,9 +3458,6 @@ public: } }; -const char* pszDummy = "\0\0"; -CScript scriptDummy(std::vector<unsigned char>(pszDummy, pszDummy + sizeof(pszDummy))); - CBlock* CreateNewBlock(CReserveKey& reservekey) { CBlockIndex* pindexPrev = pindexBest; @@ -3692,7 +3689,7 @@ CBlock* CreateNewBlock(CReserveKey& reservekey) 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(1, 1, *pblock); indexDummy.pprev = pindexPrev; indexDummy.nHeight = pindexPrev->nHeight + 1; |