mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-03-10 17:19:15 +01:00
bolt11: return error on unexpected lightning prefix
Remove the assertion so that an error is returned for invalid bech32. An error is preferable to crashing the entire node if there's an extra "lightning:" prefix: $ lightning-cli pay "lightning:lightning:" Node log: pay: common/bolt11.c:718: bolt11_decode_nosig: Assertion `!has_lightning_prefix(str)' failed. pay: FATAL SIGNAL 6 ... INFO plugin-pay: Killing plugin: exited during normal operation **BROKEN** plugin-pay: Plugin marked as important, shutting down lightningd
This commit is contained in:
parent
74b8fff3d4
commit
ee8cf69f28
3 changed files with 1 additions and 7 deletions
|
@ -721,7 +721,6 @@ struct bolt11 *bolt11_decode_nosig(const tal_t *ctx, const char *str,
|
|||
memset(have_field, 0, sizeof(have_field));
|
||||
b11->routes = tal_arr(b11, struct route_info *, 0);
|
||||
|
||||
assert(!has_lightning_prefix(str));
|
||||
if (strlen(str) < 8)
|
||||
return decode_fail(b11, fail, "Bad bech32 string");
|
||||
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
lightning:
|
|
@ -102,12 +102,6 @@ size_t LLVMFuzzerCustomMutator(uint8_t *fuzz_data, size_t size, size_t max_size,
|
|||
return initial_input(fuzz_data, size, max_size);
|
||||
}
|
||||
|
||||
// Strip (repeated) "lightning:" prefixes
|
||||
while (strstarts(output, "lightning:") ||
|
||||
strstarts(output, "LIGHTNING:")) {
|
||||
output = (char *)to_canonical_invstr(tmpctx, output);
|
||||
}
|
||||
|
||||
// Write the result into `fuzz_data`.
|
||||
size_t output_len = strlen(output);
|
||||
if (output_len > max_size)
|
||||
|
|
Loading…
Add table
Reference in a new issue