From: Guus Sliepen Date: Thu, 22 Apr 2021 22:47:15 +0000 (+0200) Subject: Fix a potential segmentation fault when log level is set to DEBUG. X-Git-Url: https://git.meshlink.io/?a=commitdiff_plain;h=777055274c4a1959318330800e449a2bc27835fb;p=meshlink Fix a potential segmentation fault when log level is set to DEBUG. --- diff --git a/src/protocol_key.c b/src/protocol_key.c index b2ba50fe..25dbc55e 100644 --- a/src/protocol_key.c +++ b/src/protocol_key.c @@ -278,7 +278,7 @@ static bool req_key_ext_h(meshlink_handle_t *mesh, connection_t *c, const char * char *canonical_address; xasprintf(&canonical_address, "%s %s", host, port); - if(mesh->log_level <= MESHLINK_DEBUG && strcmp(from->canonical_address, canonical_address)) { + if(mesh->log_level <= MESHLINK_DEBUG && (!from->canonical_address || strcmp(from->canonical_address, canonical_address))) { logger(mesh, MESHLINK_DEBUG, "Updating canonical address of %s to %s", from->name, canonical_address); }