[vte] emulation: Limit window title length



commit 23bf9277df7109467031daa88a08bf3e905ac952
Author: Christian Persch <chpe src gnome org>
Date:   Tue Mar 27 19:40:13 2018 +0200

    emulation: Limit window title length
    
    Same as xterm does.

 src/vtedefines.hh |    3 +++
 src/vteseq.cc     |    3 ++-
 2 files changed, 5 insertions(+), 1 deletions(-)
---
diff --git a/src/vtedefines.hh b/src/vtedefines.hh
index 67c26f1..4f404cc 100644
--- a/src/vtedefines.hh
+++ b/src/vtedefines.hh
@@ -140,5 +140,8 @@
  * Make sure there are enough bits to store this in VteStreamCellAttr.hyperlink_length */
 #define VTE_HYPERLINK_TOTAL_LENGTH_MAX  (VTE_HYPERLINK_ID_LENGTH_MAX + 1 + VTE_HYPERLINK_URI_LENGTH_MAX)
 
+/* Max length of title */
+#define VTE_WINDOW_TITLE_MAX_LENGTH (1024)
+
 /* Max depth of title stack */
 #define VTE_WINDOW_TITLE_STACK_MAX_DEPTH (8)
diff --git a/src/vteseq.cc b/src/vteseq.cc
index 9699574..cec74fa 100644
--- a/src/vteseq.cc
+++ b/src/vteseq.cc
@@ -6283,7 +6283,8 @@ VteTerminalPrivate::OSC(vte::parser::Sequence const& seq)
         case VTE_OSC_XTERM_SET_WINDOW_TITLE: {
                 /* Only sets window title; icon title is not supported */
                 std::string title;
-                if (it != cend)
+                if (it != cend &&
+                    it.size_remaining() < VTE_WINDOW_TITLE_MAX_LENGTH)
                         title = it.string_remaining();
                 m_window_title_pending.swap(title);
                 m_window_title_changed = true;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]