Date: Fri, 1 Mar 1996 09:55:22 +0100 From: Wolfram Schneider <wosch@cs.tu-berlin.de> To: batie@agora.rdrop.com (Alan Batie), bugs@FreeBSD.ORG Subject: Re: vi core dump Message-ID: <199603010855.JAA25172@ole.cs.tu-berlin.de> In-Reply-To: <199602290335.EAA01570@campa.panke.de> References: <m0trptJ-000AoBC@agora.rdrop.com> <199602290335.EAA01570@campa.panke.de>
index | next in thread | previous in thread | raw e-mail
Wolfram Schneider writes:
>In article <m0trptJ-000AoBC@agora.rdrop.com> batie@agora.rdrop.com (Alan Batie) writes:
>
>>The following sequence will cause vi to core dump:
>>
>> vi
>> 0 5 * * * ~ba
>
>or '~a', '~i'
>
>Fix:
Argh! You need also fix the line number.
--- vi/v_ulcase.c 1996/03/01 09:33:31 1.1
+++ vi/v_ulcase.c 1996/03/01 09:39:21
@@ -84,6 +84,7 @@
u_long cnt;
char *p;
+ len = 0;
lno = vp->m_start.lno;
cno = vp->m_start.cno;
@@ -120,7 +121,10 @@
/* Check to see if we tried to move past EOF. */
if (file_gline(sp, ep, vp->m_final.lno, &len) == NULL) {
- (void)file_gline(sp, ep, --vp->m_final.lno, &len);
+ /* line number start with 1, lno zero is illegal */
+ if (vp->m_final.lno > 1)
+ --vp->m_final.lno;
+ (void)file_gline(sp, ep, vp->m_final.lno, &len);
vp->m_final.cno = len == 0 ? 0 : len - 1;
}
return (0);
home |
help
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199603010855.JAA25172>
