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.
This commit is contained in:
Rusty Russell 2022-12-06 05:35:04 +10:30 committed by Christian Decker
parent 24d7aad3d0
commit 9751502ff5

View file

@ -1109,6 +1109,8 @@ again:
start_time),
time_from_msec(250))) {
db_commit_transaction(jcon->ld->wallet->db);
/* Call us back, as if we read nothing new */
jcon->len_read = 0;
return io_always(conn, read_json, jcon);
}
}