Browse Source

lightningd/cryptomsg: fix use-after-free introduced by dev_disconnect.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
ppa-0.6.1
Rusty Russell 8 years ago
parent
commit
212b46b1d9
  1. 3
      lightningd/cryptomsg.c

3
lightningd/cryptomsg.c

@ -332,6 +332,7 @@ struct io_plan *peer_write_message(struct io_conn *conn,
struct peer *))
{
struct io_plan *(*post)(struct io_conn *, struct peer_crypto_state *);
int type = fromwire_peektype(msg);
assert(!pcs->out);
pcs->out = cryptomsg_encrypt_msg(conn, &pcs->cs, msg);
@ -341,7 +342,7 @@ struct io_plan *peer_write_message(struct io_conn *conn,
post = peer_write_done;
switch (dev_disconnect(fromwire_peektype(msg))) {
switch (dev_disconnect(type)) {
case DEV_DISCONNECT_BEFORE:
return io_close(conn);
case DEV_DISCONNECT_DROPPKT:

Loading…
Cancel
Save