From aff6ff7ee5c0c353df6a3aa5c09fc66810c59b6e Mon Sep 17 00:00:00 2001 From: Guus Sliepen Date: Fri, 19 Jul 2019 14:40:36 +0200 Subject: [PATCH] Fix potential segmentation fault on node reachability change. --- src/graph.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/graph.c b/src/graph.c index 8e39b98d..d779ecd5 100644 --- a/src/graph.c +++ b/src/graph.c @@ -237,13 +237,14 @@ static void check_reachability(meshlink_handle_t *mesh) { update_node_udp(mesh, n, NULL); n->status.broadcast = false; n->options = 0; - utcp_offline(n->utcp, true); } else if(n->connection) { if(n->connection->outgoing) { send_req_key(mesh, n); } + } - utcp_offline(n->utcp, false); + if(n->utcp) { + utcp_offline(n->utcp, !n->status.reachable); } } } -- 2.39.5