mirror of
https://github.com/aljazceru/lightning.git
synced 2026-01-10 01:24:30 +01:00
Fix parsing of txout value. Force decimal base.
This commit is contained in:
committed by
Christian Decker
parent
160285f3ea
commit
82a2d2f0a6
@@ -95,14 +95,14 @@ bool json_tok_bitcoin_amount(const char *buffer, const jsmntok_t *tok,
|
||||
char *end;
|
||||
unsigned long btc, sat;
|
||||
|
||||
btc = strtoul(buffer + tok->start, &end, 0);
|
||||
btc = strtoul(buffer + tok->start, &end, 10);
|
||||
if (btc == ULONG_MAX && errno == ERANGE)
|
||||
return false;
|
||||
if (end != buffer + tok->end) {
|
||||
/* Expect always 8 decimal places. */
|
||||
if (*end != '.' || buffer + tok->end - end != 9)
|
||||
return false;
|
||||
sat = strtoul(end+1, &end, 0);
|
||||
sat = strtoul(end+1, &end, 10);
|
||||
if (sat == ULONG_MAX && errno == ERANGE)
|
||||
return false;
|
||||
if (end != buffer + tok->end)
|
||||
|
||||
Reference in New Issue
Block a user