[tor-commits] [arm/release] fix: getstr requests can cause curses crash

atagar at torproject.org atagar at torproject.org
Sun Jul 17 06:08:27 UTC 2011


commit 460a76e802bebb57551af5d04bc214f0a6a54a0c
Author: Damian Johnson <atagar at torproject.org>
Date:   Wed Jun 22 18:41:17 2011 -0700

    fix: getstr requests can cause curses crash
    
    The getstr function creates a curses subwindow which could make a raw addstr
    request that, if the initial value overflows the subwindow, causes curses to
    crash.
---
 src/util/panel.py |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/util/panel.py b/src/util/panel.py
index 3bdcd6f..aa3ca27 100644
--- a/src/util/panel.py
+++ b/src/util/panel.py
@@ -595,7 +595,7 @@ class Panel():
     inputSubwindow = self.parent.subwin(1, displayWidth - x, self.top, self.left + x)
     
     # prepopulates the initial text
-    if initialText: inputSubwindow.addstr(0, 0, initialText)
+    if initialText: inputSubwindow.addstr(0, 0, initialText[:displayWidth - x - 1])
     
     # Displays the text field, blocking until the user's done. This closes the
     # text panel and returns userInput to the initial text if the user presses





More information about the tor-commits mailing list