The json_str_to_u64() function contains incorrect logic. It chops one character off of the beginning and end of the JSMN token and then parses the remainder as a u64, but JSMN_STRING tokens already do not include the enclosing quotation marks, so json_str_to_u64() would actually parse the JSON string "1234" into the integer 23. Oops! Also note that it would simply fail on all input strings shorter than two characters since tok->end would wind up *before* tok->start. Just drop the function entirely. It was only used in one place, and that place explicitly doesn't care whether its input is a JSON number or a numeric string, and it was already calling json_to_u64() as an alternative, and that function already accepts both JSON strings and JSON numbers as input, so the call to json_str_to_u64() would have been entirely redundant if it had been correct. Changelog-Fixed: The `keysend` command no longer corrupts the type numbers of extra TLVs when they are specified as numeric strings longer than 2 digits.
5.0 KiB
5.0 KiB