Post
Topic
Board Development & Technical Discussion
Re: [PULL] private key and wallet export/import
by
nelisky
on 28/06/2011, 14:30:06 UTC
There's a crash caused by accessing an array element past the last one in base58.h, in the SecretToASecret function.
Code:
vch.insert(vch.end(), &vchSecret[0], &vchSecret[vchSecret.size()]);
vchSecret.size() is one past the last element, so it crashes here.

Since vchSecret is just a vector anyway, we can use this safer alternative:
Code:
vch.insert(vch.end(), vchSecret.begin(), vchSecret.end());


So the issue I posted above is a simple typo on sipa's commit. Instead of puddinpop's proposed change:

Code:
vch.insert(vch.end(), vchSecret.begin(), vchSecret.end());

You changed the code to

Code:
vch.insert(vch.end(), vch.begin(), vch.end());

The secret "vchSecret" was never being used.