mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-10-10 03:23:43 +02:00
util: Don't allow ParseMoney(...) of strings with embedded NUL characters
This commit is contained in:
@@ -7,6 +7,7 @@
|
|||||||
|
|
||||||
#include <tinyformat.h>
|
#include <tinyformat.h>
|
||||||
#include <util/strencodings.h>
|
#include <util/strencodings.h>
|
||||||
|
#include <util/string.h>
|
||||||
|
|
||||||
std::string FormatMoney(const CAmount& n)
|
std::string FormatMoney(const CAmount& n)
|
||||||
{
|
{
|
||||||
@@ -32,6 +33,9 @@ std::string FormatMoney(const CAmount& n)
|
|||||||
|
|
||||||
bool ParseMoney(const std::string& str, CAmount& nRet)
|
bool ParseMoney(const std::string& str, CAmount& nRet)
|
||||||
{
|
{
|
||||||
|
if (!ValidAsCString(str)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
return ParseMoney(str.c_str(), nRet);
|
return ParseMoney(str.c_str(), nRet);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user