]> git.meshlink.io Git - meshlink/commitdiff
Fix a potential NULL-pointer dereference when generating invitations.
authorGuus Sliepen <guus@meshlink.io>
Tue, 5 Jun 2018 18:31:04 +0000 (20:31 +0200)
committerGuus Sliepen <guus@meshlink.io>
Tue, 5 Jun 2018 18:31:04 +0000 (20:31 +0200)
Closes #47 on GitHub.

src/meshlink.c

index 66d87ee986cde60a8b3689fb0820b1bbbb7f0f51..885bfba3be57034f3007987e8cc7336de0f9b7e2 100644 (file)
@@ -388,7 +388,7 @@ static char *get_my_hostname(meshlink_handle_t *mesh) {
                return NULL;
        }
 
-       if(!strcmp(hostname[0], hostname[1])) {
+       if(hostname[0] && hostname[1] && !strcmp(hostname[0], hostname[1])) {
                free(hostname[1]);
                hostname[1] = NULL;
        }