1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-02 08:32:16 +00:00

Fix an underflow resulting from the assumption !O_ISSET(sp, O_LEFTRIGHT)

(ironically, the assumption is in a code block which is conditional on its
converse).  This isn't strictly the correct fix; it's more of a workaround
to prevent an infinite loop.  The correct fix (see
ports/editors/nvi-devel/files/patch-vi-relative r1.1) would take a file off
the vendor branch, but since the result for this version of nvi is
identical, this route was elected.

PR:		28687
Approved by:	-developers
This commit is contained in:
Dima Dorfman 2001-07-19 11:02:11 +00:00
parent 22cbe5e31f
commit 489b9470ae
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=79950

View File

@ -10,7 +10,11 @@
#include "config.h"
#ifndef lint
#if 0
static const char sccsid[] = "@(#)vs_refresh.c 10.44 (Berkeley) 10/13/96";
#endif
static const char rcsid[] =
"$FreeBSD$";
#endif /* not lint */
#include <sys/types.h>
@ -595,7 +599,7 @@ slow: for (smp = HMAP; smp->lno != LNO; ++smp);
* for the number option offset.
*/
cnt = vs_columns(sp, NULL, LNO, &CNO, NULL);
if (O_ISSET(sp, O_NUMBER))
if (O_ISSET(sp, O_NUMBER) && cnt >= O_NUMBER_LENGTH)
cnt -= O_NUMBER_LENGTH;
/* Adjust the window towards the beginning of the line. */