mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-03-15 20:09:18 +01:00
offers: save replytok properly.
We carefully copied the buffer, but the tok is inside an array. We get away with it for now, but with coming changes it gets freed. We need to copy the token and all the tokens within it. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
parent
a71f2475d5
commit
af7e0a1183
2 changed files with 4 additions and 2 deletions
|
@ -327,7 +327,8 @@ struct command_result *handle_invoice(struct command *cmd,
|
|||
|
||||
/* Make a copy of entire buffer, for later. */
|
||||
inv->buf = tal_dup_arr(inv, char, buf, replytok->end, 0);
|
||||
inv->replytok = replytok;
|
||||
inv->replytok = tal_dup_arr(inv, jsmntok_t, replytok,
|
||||
json_next(replytok) - replytok, 0);
|
||||
|
||||
inv->inv = tlv_invoice_new(cmd);
|
||||
if (!fromwire_invoice(&invbin, &len, inv->inv)) {
|
||||
|
|
|
@ -838,7 +838,8 @@ struct command_result *handle_invoice_request(struct command *cmd,
|
|||
|
||||
/* Make a copy of entire buffer, for later. */
|
||||
ir->buf = tal_dup_arr(ir, char, buf, replytok->end, 0);
|
||||
ir->replytok = replytok;
|
||||
ir->replytok = tal_dup_arr(ir, jsmntok_t, replytok,
|
||||
json_next(replytok) - replytok, 0);
|
||||
|
||||
ir->invreq = tlv_invoice_request_new(cmd);
|
||||
if (!fromwire_invoice_request(&invreqbin, &len, ir->invreq)) {
|
||||
|
|
Loading…
Add table
Reference in a new issue