From 494e5cfca22e2e8fc59a42b01d4a94418d730c2a Mon Sep 17 00:00:00 2001 From: Guus Sliepen Date: Tue, 10 Mar 2020 22:33:42 +0100 Subject: [PATCH] Ensure we process all hostnames for invitation URLs. Commit 3febbb4 allowed more addresses to be added to invitation URLs, but part of the still code assumed a maximum of 4 addresses in the URL. --- src/meshlink.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/meshlink.c b/src/meshlink.c index 6e7cda60..b9cc1877 100644 --- a/src/meshlink.c +++ b/src/meshlink.c @@ -482,7 +482,7 @@ static char *get_my_hostname(meshlink_handle_t *mesh, uint32_t flags) { } } - for(int i = 0; i < 4; i++) { + for(int i = 0; i < n; i++) { // Ensure we always have a port number if(hostname[i] && !port[i]) { port[i] = xstrdup(mesh->myport); @@ -492,7 +492,7 @@ static char *get_my_hostname(meshlink_handle_t *mesh, uint32_t flags) { remove_duplicate_hostnames(hostname, port, 4); // Resolve the hostnames - for(int i = 0; i < 4; i++) { + for(int i = 0; i < n; i++) { if(!hostname[i]) { continue; } @@ -554,10 +554,10 @@ static char *get_my_hostname(meshlink_handle_t *mesh, uint32_t flags) { } // Remove duplicates again, since IPv4 and IPv6 addresses might map to the same hostname - remove_duplicate_hostnames(hostname, port, 4); + remove_duplicate_hostnames(hostname, port, n); // Concatenate all unique address to the hostport string - for(int i = 0; i < 4; i++) { + for(int i = 0; i < n; i++) { if(!hostname[i]) { continue; } -- 2.39.2