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:
Wladimir J. van der Laan
2011-10-01 17:29:46 +02:00
parent f4769e44a3
commit 2f7f2a5fca
4 changed files with 275 additions and 8 deletions
+1 -1
View File
@@ -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;