From 624c3e6ae1209df718818742807459c814992e5b Mon Sep 17 00:00:00 2001 From: z3APA3A <3APA3A@3proxy.ru> Date: Fri, 16 Oct 2020 22:51:02 +0300 Subject: [PATCH] correct IPv6 parsing where hostname is expected --- src/common.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/common.c b/src/common.c index 1bdf5d4..58f9f4b 100644 --- a/src/common.c +++ b/src/common.c @@ -293,7 +293,10 @@ int parsehostname(char *hostname, struct clientparam *param, unsigned short port if(!hostname || !*hostname)return 2; if(*hostname == '[') se=strchr(hostname, ']'); - if ( (sp = strchr(se?se:hostname, ':')) && !strchr(sp+1, ':')) *sp = 0; + if (sp = strchr(se?se:hostname, ':')) { + if(strchr(sp+1, ':'))sp = NULL; + else *sp = 0; + } if(se){ *se = 0; }