]> asedeno.scripts.mit.edu Git - PuTTY.git/commitdiff
More sensible (and also more idiomatic) bounds checking on esc_args.
authorSimon Tatham <anakin@pobox.com>
Tue, 7 Dec 2010 00:21:42 +0000 (00:21 +0000)
committerSimon Tatham <anakin@pobox.com>
Tue, 7 Dec 2010 00:21:42 +0000 (00:21 +0000)
[originally from svn r9027]

terminal.c

index c0c809c6c7751326b21bed9b4664885461ac7da3..ba504d439bfe9d90998a378d471a73a990428fc9 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)