Skip to content

Commit 05a666e

Browse files
rustyrussellniftynei
authored andcommitted
commando: limit to 16 partially-received incoming commands at a time.
Signed-off-by: Rusty Russell <[email protected]>
1 parent 4cada55 commit 05a666e

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

plugins/commando.c

+4
Original file line numberDiff line numberDiff line change
@@ -463,6 +463,10 @@ static void handle_incmd(struct node_id *peer,
463463
incmd->contents = tal_arr(incmd, u8, 0);
464464
tal_arr_expand(&incoming_commands, incmd);
465465
tal_add_destructor2(incmd, destroy_commando, &incoming_commands);
466+
467+
/* More than 16 partial commands at once? Free oldest */
468+
if (tal_count(incoming_commands) > 16)
469+
tal_free(incoming_commands[0]);
466470
}
467471

468472
/* 1MB should be enough for anybody! */

0 commit comments

Comments
 (0)