mirror of
https://github.com/ElementsProject/elements.git
synced 2026-08-20 13:37:28 +02:00
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:
parent
f4769e44a3
commit
2f7f2a5fca
4 changed files with 275 additions and 8 deletions
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue