diff options
author | Wladimir J. van der Laan <laanwj@protonmail.com> | 2019-12-12 10:55:37 +0100 |
---|---|---|
committer | Wladimir J. van der Laan <laanwj@protonmail.com> | 2019-12-12 10:56:31 +0100 |
commit | 3914e877c476f4e83816f4bf2e4c68f0fac181b8 (patch) | |
tree | c750ed28993b90b69c3e974785b820e8c31cd5fd /src/base58.h | |
parent | 3f1966ead6b2324d863ae6c5d9956cf4b9e4b148 (diff) | |
parent | 5909bcd3bf3c3502355e89fd0b76bb8e93d8a95b (diff) | |
download | bitcoin-3914e877c476f4e83816f4bf2e4c68f0fac181b8.tar.xz |
Merge #17511: Add bounds checks before base58 decoding
5909bcd3bf3c3502355e89fd0b76bb8e93d8a95b Add bounds checks in key_io before DecodeBase58Check (Pieter Wuille)
2bcf1fc444d5c4b8efa879e54e7b6134b7e6b986 Pass a maximum output length to DecodeBase58 and DecodeBase58Check (Pieter Wuille)
Pull request description:
Fixes #17501.
ACKs for top commit:
laanwj:
code review ACK 5909bcd3bf3c3502355e89fd0b76bb8e93d8a95b
practicalswift:
ACK 5909bcd3bf3c3502355e89fd0b76bb8e93d8a95b -- code looks correct
Tree-SHA512: 4807f4a9508dee9c0f1ad63f56f70f4ec4e6b7e35eb91322a525e3da3828521a41de9b8338a6bf67250803660b480d95fd02ce6b2fe79c4c88bc19b54f9d8889
Diffstat (limited to 'src/base58.h')
-rw-r--r-- | src/base58.h | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/base58.h b/src/base58.h index d6e0299a1e..90eded4992 100644 --- a/src/base58.h +++ b/src/base58.h @@ -35,13 +35,13 @@ std::string EncodeBase58(const std::vector<unsigned char>& vch); * return true if decoding is successful. * psz cannot be nullptr. */ -NODISCARD bool DecodeBase58(const char* psz, std::vector<unsigned char>& vchRet); +NODISCARD bool DecodeBase58(const char* psz, std::vector<unsigned char>& vchRet, int max_ret_len); /** * Decode a base58-encoded string (str) into a byte vector (vchRet). * return true if decoding is successful. */ -NODISCARD bool DecodeBase58(const std::string& str, std::vector<unsigned char>& vchRet); +NODISCARD bool DecodeBase58(const std::string& str, std::vector<unsigned char>& vchRet, int max_ret_len); /** * Encode a byte vector into a base58-encoded string, including checksum @@ -52,12 +52,12 @@ std::string EncodeBase58Check(const std::vector<unsigned char>& vchIn); * Decode a base58-encoded string (psz) that includes a checksum into a byte * vector (vchRet), return true if decoding is successful */ -NODISCARD bool DecodeBase58Check(const char* psz, std::vector<unsigned char>& vchRet); +NODISCARD bool DecodeBase58Check(const char* psz, std::vector<unsigned char>& vchRet, int max_ret_len); /** * Decode a base58-encoded string (str) that includes a checksum into a byte * vector (vchRet), return true if decoding is successful */ -NODISCARD bool DecodeBase58Check(const std::string& str, std::vector<unsigned char>& vchRet); +NODISCARD bool DecodeBase58Check(const std::string& str, std::vector<unsigned char>& vchRet, int max_ret_len); #endif // BITCOIN_BASE58_H |