remove possibility of 63 bit overflow in ParseMoney
- also, add unit tests for various functions in util.cpp/util.h
This commit is contained in:
@@ -387,7 +387,7 @@ bool ParseMoney(const char* pszIn, int64& nRet)
|
||||
for (; *p; p++)
|
||||
if (!isspace(*p))
|
||||
return false;
|
||||
if (strWhole.size() > 14)
|
||||
if (strWhole.size() > 10) // guard against 63 bit overflow
|
||||
return false;
|
||||
if (nUnits < 0 || nUnits > COIN)
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user