From: Guus Sliepen Date: Fri, 19 Jul 2019 12:40:36 +0000 (+0200) Subject: Fix potential segmentation fault on node reachability change. X-Git-Url: https://git.meshlink.io/?a=commitdiff_plain;h=aff6ff7ee5c0c353df6a3aa5c09fc66810c59b6e;p=meshlink Fix potential segmentation fault on node reachability change. --- 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); } } }