diff options
-rw-r--r-- | src/util/strencodings.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/util/strencodings.cpp b/src/util/strencodings.cpp index 8f2d05f03b..dfd8961cb7 100644 --- a/src/util/strencodings.cpp +++ b/src/util/strencodings.cpp @@ -191,6 +191,12 @@ std::vector<unsigned char> DecodeBase64(const char* p, bool* pf_invalid) std::string DecodeBase64(const std::string& str, bool* pf_invalid) { + if (!ValidAsCString(str)) { + if (pf_invalid) { + *pf_invalid = true; + } + return {}; + } std::vector<unsigned char> vchRet = DecodeBase64(str.c_str(), pf_invalid); return std::string((const char*)vchRet.data(), vchRet.size()); } |