aboutsummaryrefslogtreecommitdiff
path: root/src/util
diff options
context:
space:
mode:
authorpracticalswift <practicalswift@users.noreply.github.com>2019-12-16 08:59:48 +0000
committerpracticalswift <practicalswift@users.noreply.github.com>2019-12-16 09:04:35 +0000
commitccc53e43c5464058171d6291da861a88184b230e (patch)
tree8c56fa6e768ea6accbb825c18a4996e64e61803d /src/util
parenta595011f5a3c048b2e3694dfe355aba60cd994e8 (diff)
util: Don't allow ParseMoney(...) of strings with embedded NUL characters
Diffstat (limited to 'src/util')
-rw-r--r--src/util/moneystr.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/util/moneystr.cpp b/src/util/moneystr.cpp
index ba5a12e58c..3e75a2e3e9 100644
--- a/src/util/moneystr.cpp
+++ b/src/util/moneystr.cpp
@@ -7,6 +7,7 @@
#include <tinyformat.h>
#include <util/strencodings.h>
+#include <util/string.h>
std::string FormatMoney(const CAmount& n)
{
@@ -32,6 +33,9 @@ std::string FormatMoney(const CAmount& n)
bool ParseMoney(const std::string& str, CAmount& nRet)
{
+ if (!ValidAsCString(str)) {
+ return false;
+ }
return ParseMoney(str.c_str(), nRet);
}