Fix zero-rows-cols-crash
authorowen <owen@cda61777-01e9-0310-a592-d414129be87e>
Tue, 10 Jan 2006 20:02:22 +0000 (20:02 +0000)
committerowen <owen@cda61777-01e9-0310-a592-d414129be87e>
Tue, 10 Jan 2006 20:02:22 +0000 (20:02 +0000)
git-svn-id: svn://svn.tartarus.org/sgt/putty@6515 cda61777-01e9-0310-a592-d414129be87e

terminal.c

index 2f7527c..311df18 100644 (file)
@@ -1535,6 +1535,11 @@ void term_size(Terminal *term, int newrows, int newcols, int newsavelines)
        newsavelines == term->savelines)
        return;                        /* nothing to do */
 
+    /* Behave sensibly if we're given zero (or negative) rows/cols */
+
+    if (newrows < 1) newrows = 1;
+    if (newcols < 1) newcols = 1;
+
     deselect(term);
     swap_screen(term, 0, FALSE, FALSE);