More sensible (and also more idiomatic) bounds checking on esc_args.
authorsimon <simon@cda61777-01e9-0310-a592-d414129be87e>
Tue, 7 Dec 2010 00:21:42 +0000 (00:21 +0000)
committersimon <simon@cda61777-01e9-0310-a592-d414129be87e>
Tue, 7 Dec 2010 00:21:42 +0000 (00:21 +0000)
git-svn-id: svn://svn.tartarus.org/sgt/putty@9027 cda61777-01e9-0310-a592-d414129be87e

terminal.c

index c0c809c..ba504d4 100644 (file)
@@ -3290,8 +3290,8 @@ static void term_out(Terminal *term)
                    }
                    term->termstate = SEEN_CSI;
                } else if (c == ';') {
-                   if (++term->esc_nargs <= ARGS_MAX)
-                       term->esc_args[term->esc_nargs - 1] = ARG_DEFAULT;
+                   if (term->esc_nargs < ARGS_MAX)
+                       term->esc_args[term->esc_nargs++] = ARG_DEFAULT;
                    term->termstate = SEEN_CSI;
                } else if (c < '@') {
                    if (term->esc_query)