X-Git-Url: https://asedeno.scripts.mit.edu/gitweb/?a=blobdiff_plain;f=windows%2Fwindow.c;h=17aaf1ae591a260af779e547ef7e5150b0b731ca;hb=4e550f96b2edcf33f2480d2374815ec3df6a60f5;hp=c80a25d3dd207de896f77ef23a652f7a1a4481ee;hpb=7573f3733f3ba896018dc7b1cdd2b3a51b450096;p=PuTTY.git diff --git a/windows/window.c b/windows/window.c index c80a25d3..17aaf1ae 100644 --- a/windows/window.c +++ b/windows/window.c @@ -542,9 +542,20 @@ int WINAPI WinMain(HINSTANCE inst, HINSTANCE prev, LPSTR cmdline, int show) } /* - * Trim a colon suffix off the hostname if it's there. + * Trim a colon suffix off the hostname if it's there. In + * order to protect IPv6 address literals against this + * treatment, we do not do this if there's _more_ than one + * colon. */ - cfg.host[strcspn(cfg.host, ":")] = '\0'; + { + char *c = strchr(cfg.host, ':'); + + if (c) { + char *d = strchr(c+1, ':'); + if (!d) + *c = '\0'; + } + } /* * Remove any remaining whitespace from the hostname.