WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] [xen-unstable] [PYGRUB] Fix a few bounds violations in p

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] [PYGRUB] Fix a few bounds violations in pygrub's command-line editor.
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Thu, 09 Nov 2006 18:40:21 +0000
Delivery-date: Thu, 09 Nov 2006 10:41:13 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User Tim Deegan <Tim.Deegan@xxxxxxxxxxxxx>
# Node ID 14dc20d98ee1478ad17abcbb24ae6dec46521178
# Parent  72579f0cdaf7acaf722b366fbb9d3e0114028493
[PYGRUB] Fix a few bounds violations in pygrub's command-line editor.
Don't step off the end of the line, or delete characters that aren't there.

Signed-off-by: Ryan Harper <ryanh@xxxxxxxxxx>
Signed-off-by: Tim Deegan <Tim.Deegan@xxxxxxxxxxxxx>
---
 tools/pygrub/src/pygrub |   12 ++++++++----
 1 files changed, 8 insertions(+), 4 deletions(-)

diff -r 72579f0cdaf7 -r 14dc20d98ee1 tools/pygrub/src/pygrub
--- a/tools/pygrub/src/pygrub   Thu Nov 09 14:11:11 2006 +0000
+++ b/tools/pygrub/src/pygrub   Thu Nov 09 14:23:24 2006 +0000
@@ -113,17 +113,21 @@ class GrubLineEditor(curses.textpad.Text
         elif ch == curses.ascii.SOH:  # ^a
             self.pos = 0
         elif ch in (curses.ascii.STX,curses.KEY_LEFT):
-            self.pos -= 1
+            if self.pos > 0:
+                self.pos -= 1
         elif ch in (curses.ascii.BS,curses.KEY_BACKSPACE):
             if self.pos > 0:
                 self.pos -= 1
+                if self.pos < len(self.line):
+                    self.line.pop(self.pos)
+        elif ch == curses.ascii.EOT:                           # ^d
+            if self.pos < len(self.line):
                 self.line.pop(self.pos)
-        elif ch == curses.ascii.EOT:                           # ^d
-            self.line.pop(self.pos)
         elif ch == curses.ascii.ENQ:                           # ^e
             self.pos = len(self.line)
         elif ch in (curses.ascii.ACK, curses.KEY_RIGHT):
-            self.pos +=1
+            if self.pos < len(self.line):
+                self.pos +=1
         elif ch == curses.ascii.VT:                            # ^k
             self.line = self.line[:self.pos]
         else:

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] [PYGRUB] Fix a few bounds violations in pygrub's command-line editor., Xen patchbot-unstable <=