diff options
author | dd <dd@FreeBSD.org> | 2001-07-19 11:02:11 +0000 |
---|---|---|
committer | dd <dd@FreeBSD.org> | 2001-07-19 11:02:11 +0000 |
commit | 734109808b87fef2a6f5784952c72430b4a3c3a0 (patch) | |
tree | 6ab8f62a758f3c05296c166d0f88baeb9d85f9ec /contrib/nvi/vi | |
parent | 280c82d1383436f61f3dbd2fb8a178178b1334fc (diff) | |
download | FreeBSD-src-734109808b87fef2a6f5784952c72430b4a3c3a0.zip FreeBSD-src-734109808b87fef2a6f5784952c72430b4a3c3a0.tar.gz |
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
Diffstat (limited to 'contrib/nvi/vi')
-rw-r--r-- | contrib/nvi/vi/vs_refresh.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/contrib/nvi/vi/vs_refresh.c b/contrib/nvi/vi/vs_refresh.c index d954c62..f69d382 100644 --- a/contrib/nvi/vi/vs_refresh.c +++ b/contrib/nvi/vi/vs_refresh.c @@ -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. */ |