diff options
author | Luke Dashjr <luke-jr+git@utopios.org> | 2012-03-16 16:44:00 -0400 |
---|---|---|
committer | Luke Dashjr <luke-jr+git@utopios.org> | 2012-03-16 16:44:00 -0400 |
commit | 78b9d2de40144e6f420518bcdf62168855546ded (patch) | |
tree | b1f761e093bc60f82c793f3144f226d0d7e666fb /src/key.h | |
parent | 27960a36de879634ee8c491d0f4fe8160e8a4f75 (diff) | |
parent | 91aadbdacf9a3111da76eb831ea36d6827e1d6fc (diff) | |
download | bitcoin-78b9d2de40144e6f420518bcdf62168855546ded.tar.xz |
Merge branch '0.4.x' into 0.5.0.x
Conflicts:
contrib/Bitcoin.app/Contents/Info.plist
doc/README
doc/README_windows.txt
share/setup.nsi
src/serialize.h
Diffstat (limited to 'src/key.h')
-rw-r--r-- | src/key.h | 13 |
1 files changed, 7 insertions, 6 deletions
@@ -290,13 +290,14 @@ public: bool Sign(uint256 hash, std::vector<unsigned char>& vchSig) { - vchSig.clear(); - unsigned char pchSig[10000]; - unsigned int nSize = 0; - if (!ECDSA_sign(0, (unsigned char*)&hash, sizeof(hash), pchSig, &nSize, pkey)) + unsigned int nSize = ECDSA_size(pkey); + vchSig.resize(nSize); // Make sure it is big enough + if (!ECDSA_sign(0, (unsigned char*)&hash, sizeof(hash), &vchSig[0], &nSize, pkey)) + { + vchSig.clear(); return false; - vchSig.resize(nSize); - memcpy(&vchSig[0], pchSig, nSize); + } + vchSig.resize(nSize); // Shrink to fit actual size return true; } |