From: Guus Sliepen Date: Tue, 5 Jun 2018 18:31:04 +0000 (+0200) Subject: Fix a potential NULL-pointer dereference when generating invitations. X-Git-Url: https://git.meshlink.io/?a=commitdiff_plain;h=87d6dff00480a9d354f8b4ade6dfa41cb06118cb;p=meshlink Fix a potential NULL-pointer dereference when generating invitations. Closes #47 on GitHub. --- 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; }