diff options
author | Jesse Luehrs <doy@tozt.net> | 2014-10-20 21:56:21 -0400 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2014-10-20 21:56:21 -0400 |
commit | 90dfce0d3edc92287ce1519dafc7e91ba70c1368 (patch) | |
tree | 2b2c22717382a41f0e294dd1f7c41b5980910e8d /src/parser.l | |
parent | cb9792c7aa503f877091b01f25986eccc6469e82 (diff) | |
download | libvt100-90dfce0d3edc92287ce1519dafc7e91ba70c1368.tar.gz libvt100-90dfce0d3edc92287ce1519dafc7e91ba70c1368.zip |
don't segfault on CUP with large parameters
Diffstat (limited to 'src/parser.l')
-rw-r--r-- | src/parser.l | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/parser.l b/src/parser.l index cdf1efc..010411e 100644 --- a/src/parser.l +++ b/src/parser.l @@ -423,6 +423,14 @@ static void vt100_parser_handle_cup(VT100Screen *vt, char *buf, size_t len) if (params[1] == 0) { params[1] = 1; } + /* this needs to be fixed up here (and not in screen.c) because CUP hsould + * never cause scrolling */ + if (params[0] > vt->grid->max.row) { + params[0] = vt->grid->max.row; + } + if (params[1] > vt->grid->max.col) { + params[1] = vt->grid->max.col; + } vt100_screen_move_to(vt, params[0] - 1, params[1] - 1); } |