X-Git-Url: https://asedeno.scripts.mit.edu/gitweb/?a=blobdiff_plain;f=windows%2Fwindow.c;h=8d13ff911754f2abb0a545d7dc779200faea834a;hb=0cc6fb8bfea07360afeac83ba67aceffb56499c8;hp=f1f72525a305a0b6ed34d95f31e26db9df236482;hpb=81a11efdafd5de1cd14efcbdc279cc2f404eb3d5;p=PuTTY.git diff --git a/windows/window.c b/windows/window.c index f1f72525..8d13ff91 100644 --- a/windows/window.c +++ b/windows/window.c @@ -168,7 +168,7 @@ struct agent_callback { #define FONT_OEMUND 0x22 #define FONT_OEMBOLDUND 0x23 -#define FONT_MAXNO 0x2F +#define FONT_MAXNO 0x40 #define FONT_SHIFT 5 static HFONT fonts[FONT_MAXNO]; static LOGFONT lfont; @@ -617,10 +617,21 @@ int WINAPI WinMain(HINSTANCE inst, HINSTANCE prev, LPSTR cmdline, int show) } } - /* - * Trim off a colon suffix if it's there. - */ - host[strcspn(host, ":")] = '\0'; + /* + * 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. + */ + { + char *c = strchr(host, ':'); + + if (c) { + char *d = strchr(c+1, ':'); + if (!d) + *c = '\0'; + } + } /* * Remove any remaining whitespace.