Skip to content

Commit 9751502

Browse files
rustyrussellcdecker
authored andcommitted
jsonrpc: fix error when we abort batching due to timeout.
The read_json() call expects len_read to be the amount of *new* data read. If we call this back without resetting, it will parse this much random junk in the buffer. Fixes: #5766 Changelog-Fixed: Plugin: `autoclean` could misperform or get killed due to lightningd's invalid handling of JSON batching.
1 parent 24d7aad commit 9751502

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

lightningd/jsonrpc.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1109,6 +1109,8 @@ static struct io_plan *read_json(struct io_conn *conn,
11091109
start_time),
11101110
time_from_msec(250))) {
11111111
db_commit_transaction(jcon->ld->wallet->db);
1112+
/* Call us back, as if we read nothing new */
1113+
jcon->len_read = 0;
11121114
return io_always(conn, read_json, jcon);
11131115
}
11141116
}

0 commit comments

Comments
 (0)