]> git.meshlink.io Git - meshlink/commitdiff
Fix a potential segmentation fault when log level is set to DEBUG.
authorGuus Sliepen <guus@meshlink.io>
Thu, 22 Apr 2021 22:47:15 +0000 (00:47 +0200)
committerGuus Sliepen <guus@meshlink.io>
Thu, 22 Apr 2021 22:47:15 +0000 (00:47 +0200)
src/protocol_key.c

index b2ba50fe14de198573fc1a9424c6b2e6ddf28327..25dbc55e5c04b7533e9eb0f6c5eeb62214cc648e 100644 (file)
@@ -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);
                }