Reinstate a piece of code accidentally removed in r9214, where Windows
[u/mdw/putty] / windows / window.c
index b477d6a..8d13ff9 100644 (file)
@@ -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.
@@ -4805,7 +4816,7 @@ void palette_set(void *frontend, int n, int r, int g, int b)
 {
     if (n >= 16)
        n += 256 - 16;
-    if (n > NALLCOLOURS)
+    if (n >= NALLCOLOURS)
        return;
     real_palette_set(n, r, g, b);
     if (pal) {