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

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



commit 460a76e802bebb57551af5d04bc214f0a6a54a0c
Author: Damian Johnson <atagar@xxxxxxxxxxxxxx>
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



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits