~mdw
/
sgt
/
putty
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Rewrite of Unix sk_newlistener() which should fix any possible
[sgt/putty]
/
windows
/
window.c
diff --git
a/windows/window.c
b/windows/window.c
index
c80a25d
..
17aaf1a
100644
(file)
--- 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.
/*
* Remove any remaining whitespace from the hostname.