From 98ce2f265f986fb88c38d508286bb5e3716b9e74 Mon Sep 17 00:00:00 2001 From: Christian Persch Date: Sat, 19 May 2012 18:04:12 +0000 Subject: emulation: Limit repetitions Don't allow malicious sequences to cause excessive repetitions. https://bugzilla.gnome.org/show_bug.cgi?id=676090 --- diff --git a/src/vteseq.c b/src/vteseq.c index 46def5b..7fb4707 100644 --- a/src/vteseq.c +++ b/src/vteseq.c @@ -1397,7 +1397,7 @@ vte_sequence_handler_dc (VteTerminal *terminal, GValueArray *params) static void vte_sequence_handler_DC (VteTerminal *terminal, GValueArray *params) { - vte_sequence_handler_multiple(terminal, params, vte_sequence_handler_dc); + vte_sequence_handler_multiple_r(terminal, params, vte_sequence_handler_dc); } /* Delete a line at the current cursor position. */ @@ -1790,7 +1790,7 @@ vte_sequence_handler_reverse_index (VteTerminal *terminal, GValueArray *params) static void vte_sequence_handler_RI (VteTerminal *terminal, GValueArray *params) { - vte_sequence_handler_multiple(terminal, params, vte_sequence_handler_nd); + vte_sequence_handler_multiple_r(terminal, params, vte_sequence_handler_nd); } /* Save cursor (position). */ @@ -2782,8 +2782,7 @@ vte_sequence_handler_insert_lines (VteTerminal *terminal, GValueArray *params) { GValue *value; VteScreen *screen; - long param, end, row; - int i; + long param, end, row, i, limit; screen = terminal->pvt->screen; /* The default is one. */ param = 1; @@ -2801,7 +2800,13 @@ vte_sequence_handler_insert_lines (VteTerminal *terminal, GValueArray *params) } else { end = screen->insert_delta + terminal->row_count - 1; } - /* Insert the new lines at the cursor. */ + + /* Only allow to insert as many lines as there are between this row + * and the end of the scrolling region. See bug #676090. + */ + limit = end - row + 1; + param = MIN (param, limit); + for (i = 0; i < param; i++) { /* Clear a line off the end of the region and add one to the * top of the region. */ @@ -2822,8 +2827,7 @@ vte_sequence_handler_delete_lines (VteTerminal *terminal, GValueArray *params) { GValue *value; VteScreen *screen; - long param, end, row; - int i; + long param, end, row, i, limit; screen = terminal->pvt->screen; /* The default is one. */ @@ -2842,6 +2846,13 @@ vte_sequence_handler_delete_lines (VteTerminal *terminal, GValueArray *params) } else { end = screen->insert_delta + terminal->row_count - 1; } + + /* Only allow to delete as many lines as there are between this row + * and the end of the scrolling region. See bug #676090. + */ + limit = end - row + 1; + param = MIN (param, limit); + /* Clear them from below the current cursor. */ for (i = 0; i < param; i++) { /* Insert a line at the end of the region and remove one from -- cgit v0.9.0.2 '2020-02-17 11:49:08 +0100'>2020-02-17bootstrap: Fix typo....* bootstrap: Substitute ‘guix-cookbook’ for copy/pasted ‘guix-manual’. Reported-by: jetomit on #guix Tobias Geerinckx-Rice 2019-09-18doc: Add Guix Cookbook....* .gitignore: Update ignore list. * Makefile.am (assert-no-store-file-names): Exclude the cookbook. * bootstrap: Generate po files for cookbook translations. * doc/guix-cookbook.texi: New file. * doc/local.mk (info_TEXINFOS): Add it; add a rule to build cookbook translations. * po/doc/local.mk (DOC_COOKBOOK_PO_FILES): New variable. (EXTRA_DIST): Add cookbook pot file and po files. (doc-po-update-cookbook-%): New target. (doc-pot-update): Also update cookbook pot file. (doc-po-update): Also update cookbook po files. Ricardo Wurmus 2019-04-26bootstrap: Break automake dependency on generated files....* bootstrap: Generate stub files for the manual translations whose generated files are not included in the VCS. * doc/contributing.de.texi: Remove file. * doc/contributing.es.texi: Remove file. * doc/contributing.fr.texi: Remove file. * doc/contributing.zh_CN.texi: Remove file. * doc/guix.de.texi: Remove file. * doc/guix.es.texi: Remove file. * doc/guix.fr.texi: Remove file. * doc/guix.zh_CN.texi: Remove file. * .gitignore: Add them. Signed-off-by: Julien Lepiller <julien@lepiller.eu> Miguel Ángel Arruga Vivas