From 87d6dff00480a9d354f8b4ade6dfa41cb06118cb Mon Sep 17 00:00:00 2001 From: Guus Sliepen Date: Tue, 5 Jun 2018 20:31:04 +0200 Subject: [PATCH] Fix a potential NULL-pointer dereference when generating invitations. Closes #47 on GitHub. --- src/meshlink.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/meshlink.c b/src/meshlink.c index 66d87ee9..885bfba3 100644 --- a/src/meshlink.c +++ b/src/meshlink.c @@ -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; } -- 2.39.5