Skip to content

Commit ccc53e4

Browse files
util: Don't allow ParseMoney(...) of strings with embedded NUL characters
1 parent a595011 commit ccc53e4

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/util/moneystr.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
#include <tinyformat.h>
99
#include <util/strencodings.h>
10+
#include <util/string.h>
1011

1112
std::string FormatMoney(const CAmount& n)
1213
{
@@ -32,6 +33,9 @@ std::string FormatMoney(const CAmount& n)
3233

3334
bool ParseMoney(const std::string& str, CAmount& nRet)
3435
{
36+
if (!ValidAsCString(str)) {
37+
return false;
38+
}
3539
return ParseMoney(str.c_str(), nRet);
3640
}
3741

0 commit comments

Comments
 (0)