Skip to content

Commit 8c8fdf4

Browse files
erickcestaridaywalker90
authored andcommitted
dualopend: initialize state->reconnected on startup
state->reconnected was only set to true after do_reconnect_dance(), so a fresh dualopend never wrote it. A commitment_signed arriving out of turn in the main loop made handle_commit_signed() read an uninitialized bool, which UBSan flags as a load of an invalid bool value. Default it to false, so an out-of-turn commitment_signed is always rejected unless we really reconnected. Changelog-None Signed-off-by: Erick Cestari <erickcestari03@gmail.com>
1 parent 5685c9a commit 8c8fdf4

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

‎openingd/dualopend.c‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4410,8 +4410,9 @@ int main(int argc, char *argv[])
44104410
* writing to REQ_FD */
44114411
status_setup_sync(REQ_FD);
44124412

4413-
/* Init state to not aborted */
4413+
/* Init state to not aborted, and not reconnected until we know better */
44144414
state->aborted_err = NULL;
4415+
state->reconnected = false;
44154416

44164417
/*~ The very first thing we read from lightningd is our init msg */
44174418
msg = wire_sync_read(tmpctx, REQ_FD);

0 commit comments

Comments
 (0)