Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/lib/libcurses Don't crash if asked to touch more lines than ...



details:   https://anonhg.NetBSD.org/src/rev/b7f40f3dc106
branches:  trunk
changeset: 586778:b7f40f3dc106
user:      jdc <jdc%NetBSD.org@localhost>
date:      Sun Jan 01 11:48:31 2006 +0000

description:
Don't crash if asked to touch more lines than there are in a window.

diffstat:

 lib/libcurses/touchwin.c |  6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diffs (27 lines):

diff -r b49af00dffc7 -r b7f40f3dc106 lib/libcurses/touchwin.c
--- a/lib/libcurses/touchwin.c  Sun Jan 01 11:32:41 2006 +0000
+++ b/lib/libcurses/touchwin.c  Sun Jan 01 11:48:31 2006 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: touchwin.c,v 1.20 2003/10/05 10:13:03 jdc Exp $        */
+/*     $NetBSD: touchwin.c,v 1.21 2006/01/01 11:48:31 jdc Exp $        */
 
 /*
  * Copyright (c) 1981, 1993, 1994
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = "@(#)touchwin.c 8.2 (Berkeley) 5/4/94";
 #else
-__RCSID("$NetBSD: touchwin.c,v 1.20 2003/10/05 10:13:03 jdc Exp $");
+__RCSID("$NetBSD: touchwin.c,v 1.21 2006/01/01 11:48:31 jdc Exp $");
 #endif
 #endif                         /* not lint */
 
@@ -146,6 +146,8 @@
 #ifdef DEBUG
        __CTRACE("wtouchln: (%p) %d, %d, %d\n", win, line, n, changed);
 #endif
+       if (line + n > win->maxy)
+               line = win->maxy - n;
        for (y = line; y < line + n; y++) {
                if (changed == 1)
                        __touchline(win, y, 0, (int) win->maxx - 1);



Home | Main Index | Thread Index | Old Index