Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 18 Jan 2002 04:13:17 +0300
From:      "Alexey V. Neyman" <alex.neyman@auriga.ru>
To:        freebsd-bugs@FreeBSD.org
Cc:        sheldonh@FreeBSD.org
Subject:   Re: bin/26869: vi(1) crashes in viewing a file with long lines
Message-ID:  <0201180413170G.01587@vagabond.auriga.ru>
In-Reply-To: <200201180050.g0I0o3B30448@freefall.freebsd.org>
References:  <200201180050.g0I0o3B30448@freefall.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help

Here it is.

Index: vs_line.c
===================================================================
RCS file: /usr/local/cvsroot/src/contrib/nvi/vi/vs_line.c,v
retrieving revision 1.2
diff -u -r1.2 vs_line.c
--- vs_line.c	2 Aug 1998 15:18:44 -0000	1.2
+++ vs_line.c	18 Jan 2002 00:49:03 -0000
@@ -324,8 +324,11 @@
 		/* If the line is on the screen, quit. */
 		if (is_cached)
 			goto ret1;
-	} else
+	} else {
+		if (sp->cno >= len)
+			sp->cno = len - 1;
 		cno_cnt = (sp->cno - offset_in_line) + 1;
+	}
 
 	/* This is the loop that actually displays characters. */
 	ecbp = (cbp = cbuf) + sizeof(cbuf) - 1;

-- 
<------------------------->
 ) May the Sun and Water (   Regards, Alexey V. Neyman
 ) always fall upon you! (   mailto:alex.neyman@auriga.ru
<------------------------->

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?0201180413170G.01587>