summaryrefslogtreecommitdiff
path: root/src/network
diff options
context:
space:
mode:
Diffstat (limited to 'src/network')
-rw-r--r--src/network/core/address.h2
-rw-r--r--src/network/network.cpp11
2 files changed, 12 insertions, 1 deletions
diff --git a/src/network/core/address.h b/src/network/core/address.h
index 0d0f61f7e..e0ef9889b 100644
--- a/src/network/core/address.h
+++ b/src/network/core/address.h
@@ -96,7 +96,7 @@ public:
if (StrEmpty(hostname)) hostname = "";
if (*hostname == '[') hostname++;
strecpy(this->hostname, StrEmpty(hostname) ? "" : hostname, lastof(this->hostname));
- char *tmp = strrchr(hostname, ']');
+ char *tmp = strrchr(this->hostname, ']');
if (tmp != NULL) *tmp = '\0';
memset(&this->address, 0, sizeof(this->address));
diff --git a/src/network/network.cpp b/src/network/network.cpp
index c04e3853d..c5f24e666 100644
--- a/src/network/network.cpp
+++ b/src/network/network.cpp
@@ -374,14 +374,25 @@ static void CheckMinActiveClients()
* occupied by connection_string. */
void ParseConnectionString(const char **company, const char **port, char *connection_string)
{
+ bool ipv6 = false;
char *p;
for (p = connection_string; *p != '\0'; p++) {
switch (*p) {
+ case '[':
+ ipv6 = true;
+ break;
+
+ case ']':
+ ipv6 = false;
+ break;
+
case '#':
*company = p + 1;
*p = '\0';
break;
+
case ':':
+ if (ipv6) break;
*port = p + 1;
*p = '\0';
break;