mirror of
https://github.com/dashpay/dash.git
synced 2024-12-25 12:02:48 +01:00
Merge pull request #4944
018cec7
Fixing 'vector out of bounds' issue in base 32 and 64 (ENikS)
This commit is contained in:
commit
2fc6c67400
@ -224,7 +224,7 @@ vector<unsigned char> DecodeBase64(const char* p, bool* pfInvalid)
|
|||||||
string DecodeBase64(const string& str)
|
string DecodeBase64(const string& str)
|
||||||
{
|
{
|
||||||
vector<unsigned char> vchRet = DecodeBase64(str.c_str());
|
vector<unsigned char> vchRet = DecodeBase64(str.c_str());
|
||||||
return string((const char*)&vchRet[0], vchRet.size());
|
return (vchRet.size() == 0) ? string() : string((const char*)&vchRet[0], vchRet.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
string EncodeBase32(const unsigned char* pch, size_t len)
|
string EncodeBase32(const unsigned char* pch, size_t len)
|
||||||
@ -411,7 +411,7 @@ vector<unsigned char> DecodeBase32(const char* p, bool* pfInvalid)
|
|||||||
string DecodeBase32(const string& str)
|
string DecodeBase32(const string& str)
|
||||||
{
|
{
|
||||||
vector<unsigned char> vchRet = DecodeBase32(str.c_str());
|
vector<unsigned char> vchRet = DecodeBase32(str.c_str());
|
||||||
return string((const char*)&vchRet[0], vchRet.size());
|
return (vchRet.size() == 0) ? string() : string((const char*)&vchRet[0], vchRet.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ParseInt32(const std::string& str, int32_t *out)
|
bool ParseInt32(const std::string& str, int32_t *out)
|
||||||
|
Loading…
Reference in New Issue
Block a user