Source-Changes-HG archive

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

[src/trunk]: src/lib/libterm Fix off by one bug in t_agetstr - the pointer is...



details:   https://anonhg.NetBSD.org/src/rev/66cecffadf97
branches:  trunk
changeset: 519062:66cecffadf97
user:      blymn <blymn%NetBSD.org@localhost>
date:      Mon Dec 10 12:11:05 2001 +0000

description:
Fix off by one bug in t_agetstr - the pointer is moved to one past the
end of the termcap capability string.

diffstat:

 lib/libterm/termcap.c |  6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diffs (27 lines):

diff -r 673e0f37f40d -r 66cecffadf97 lib/libterm/termcap.c
--- a/lib/libterm/termcap.c     Mon Dec 10 12:09:33 2001 +0000
+++ b/lib/libterm/termcap.c     Mon Dec 10 12:11:05 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: termcap.c,v 1.42 2001/12/02 06:38:51 blymn Exp $       */
+/*     $NetBSD: termcap.c,v 1.43 2001/12/10 12:11:05 blymn Exp $       */
 
 /*
  * Copyright (c) 1980, 1993
@@ -38,7 +38,7 @@
 #if 0
 static char sccsid[] = "@(#)termcap.c  8.1 (Berkeley) 6/4/93";
 #else
-__RCSID("$NetBSD: termcap.c,v 1.42 2001/12/02 06:38:51 blymn Exp $");
+__RCSID("$NetBSD: termcap.c,v 1.43 2001/12/10 12:11:05 blymn Exp $");
 #endif
 #endif /* not lint */
 
@@ -470,7 +470,7 @@
        if (new_size == 0)
                return NULL;
 
-       if ((tb = info->tbuf) == NULL || (tb->eptr - tb->ptr) < new_size) {
+       if ((tb = info->tbuf) == NULL || (tb->eptr - tb->ptr) < (new_size + 1)) {
                if (new_size < BSIZE)
                        new_size = BSIZE;
                else



Home | Main Index | Thread Index | Old Index