mirror of
https://github.com/dashpay/dash.git
synced 2024-12-27 04:52:59 +01:00
Merge pull request #4337
88df548
base58: add paranoid return value checks (Jeff Garzik)
This commit is contained in:
commit
f73082db87
@ -114,9 +114,8 @@ std::string EncodeBase58Check(const std::vector<unsigned char>& vchIn) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool DecodeBase58Check(const char* psz, std::vector<unsigned char>& vchRet) {
|
bool DecodeBase58Check(const char* psz, std::vector<unsigned char>& vchRet) {
|
||||||
if (!DecodeBase58(psz, vchRet))
|
if (!DecodeBase58(psz, vchRet) ||
|
||||||
return false;
|
(vchRet.size() < 4))
|
||||||
if (vchRet.size() < 4)
|
|
||||||
{
|
{
|
||||||
vchRet.clear();
|
vchRet.clear();
|
||||||
return false;
|
return false;
|
||||||
@ -154,8 +153,8 @@ void CBase58Data::SetData(const std::vector<unsigned char> &vchVersionIn, const
|
|||||||
|
|
||||||
bool CBase58Data::SetString(const char* psz, unsigned int nVersionBytes) {
|
bool CBase58Data::SetString(const char* psz, unsigned int nVersionBytes) {
|
||||||
std::vector<unsigned char> vchTemp;
|
std::vector<unsigned char> vchTemp;
|
||||||
DecodeBase58Check(psz, vchTemp);
|
bool rc58 = DecodeBase58Check(psz, vchTemp);
|
||||||
if (vchTemp.size() < nVersionBytes) {
|
if ((!rc58) || (vchTemp.size() < nVersionBytes)) {
|
||||||
vchData.clear();
|
vchData.clear();
|
||||||
vchVersion.clear();
|
vchVersion.clear();
|
||||||
return false;
|
return false;
|
||||||
|
Loading…
Reference in New Issue
Block a user