From 734109808b87fef2a6f5784952c72430b4a3c3a0 Mon Sep 17 00:00:00 2001
From: dd
Date: Thu, 19 Jul 2001 11:02:11 +0000
Subject: 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
---
contrib/nvi/vi/vs_refresh.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
(limited to 'contrib/nvi')
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
@@ -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. */
--
cgit v1.1