editors/nvi2: Fix core dump when tags file pattern has a trailing '\'
If you create a tags file of a macro that ends with a '\' and tag for it, vi dumps core. For example: zinc 76 % cat test.h #define LATIN2PLAIN(ch) (((u_char)ch) >= 0x80 ? \ pgm_read_byte_far(pgm_get_far_address(latin2plain) + \ (((u_char)ch) - 0x80)) : (isprint(ch) ? (ch) : '_')) zinc 77 % ctags test.h zinc 78 % vi -t LATIN2PLAIN Segmentation fault The problem is that the loop variable is unsigned (size_t) and it gets decremented twice: 1 -> 0 -> 4294967295 Apply the upstream patch to solve this: https://github.com/lichray/nvi2/pull/111
This commit is contained in:
parent
4b8ac78ce3
commit
5ac4f1e502
@ -1,6 +1,7 @@
|
||||
PORTNAME= nvi2
|
||||
PORTVERSION= 2.2.0
|
||||
DISTVERSIONPREFIX= v
|
||||
PORTREVISION= 1
|
||||
CATEGORIES= editors
|
||||
|
||||
MAINTAINER= leres@FreeBSD.org
|
||||
|
12
editors/nvi2/files/patch-ex_ex__subst.c
Normal file
12
editors/nvi2/files/patch-ex_ex__subst.c
Normal file
@ -0,0 +1,12 @@
|
||||
--- ex/ex_subst.c.orig 2020-08-01 22:27:51 UTC
|
||||
+++ ex/ex_subst.c
|
||||
@@ -1194,7 +1194,8 @@ re_tag_conv(SCR *sp, CHAR_T **ptrnp, size_t *plenp, in
|
||||
for (; len > 0; --len) {
|
||||
if (p[0] == '\\' && (p[1] == '/' || p[1] == '?')) {
|
||||
++p;
|
||||
- --len;
|
||||
+ if (len > 1)
|
||||
+ --len;
|
||||
} else if (STRCHR(L("^.[]$*"), p[0]))
|
||||
*t++ = '\\';
|
||||
*t++ = *p++;
|
Loading…
Reference in New Issue
Block a user