Strip off and ignore `:port' on the end of a hostname.
[u/mdw/putty] / window.c
index 063f0db..3c67ddf 100644 (file)
--- a/window.c
+++ b/window.c
@@ -299,6 +299,11 @@ int WINAPI WinMain(HINSTANCE inst, HINSTANCE prev, LPSTR cmdline, int show)
                memmove(cfg.host, atsign + 1, 1 + strlen(atsign + 1));
            }
        }
+
+       /*
+        * Trim a colon suffix off the hostname if it's there.
+        */
+       cfg.host[strcspn(cfg.host, ":")] = '\0';
     }
 
     /*