Commit 263644b
common/json_parse_simple: drop redundant and wrong json_str_to_u64()
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.1 parent ea2fecc commit 263644b
3 files changed
+1
-19
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
975 | 975 | | |
976 | 976 | | |
977 | 977 | | |
978 | | - | |
979 | | - | |
| 978 | + | |
980 | 979 | | |
981 | 980 | | |
982 | 981 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
109 | 109 | | |
110 | 110 | | |
111 | 111 | | |
112 | | - | |
113 | | - | |
114 | | - | |
115 | | - | |
116 | | - | |
117 | | - | |
118 | | - | |
119 | | - | |
120 | | - | |
121 | | - | |
122 | | - | |
123 | | - | |
124 | | - | |
125 | 112 | | |
126 | 113 | | |
127 | 114 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
42 | 42 | | |
43 | 43 | | |
44 | 44 | | |
45 | | - | |
46 | | - | |
47 | | - | |
48 | | - | |
49 | 45 | | |
50 | 46 | | |
51 | 47 | | |
| |||
0 commit comments