From ccc53e43c5464058171d6291da861a88184b230e Mon Sep 17 00:00:00 2001 From: practicalswift Date: Mon, 16 Dec 2019 08:59:48 +0000 Subject: util: Don't allow ParseMoney(...) of strings with embedded NUL characters --- src/util/moneystr.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src') 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 #include +#include 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); } -- cgit v1.2.3