Pull up following revision(s) (requested by gutteridge in ticket #1606):

external/bsd/nvi/dist/common/search.c: revision 1.5

search.c: correctly handle escaped backslashes

Addresses PR bin/57106 from Bosco G. G., who supplied the patch.

(This was also committed in the nvi2 sources:
e7054267a3)
This commit is contained in:
martin 2023-02-24 13:06:48 +00:00
parent e44a90cdec
commit b828bb68fd
1 changed files with 10 additions and 5 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: search.c,v 1.4 2017/11/22 16:17:30 rin Exp $ */
/* $NetBSD: search.c,v 1.4.6.1 2023/02/24 13:06:48 martin Exp $ */
/*-
* Copyright (c) 1992, 1993, 1994
* The Regents of the University of California. All rights reserved.
@ -16,7 +16,7 @@
static const char sccsid[] = "Id: search.c,v 10.31 2001/06/25 15:19:12 skimo Exp (Berkeley) Date: 2001/06/25 15:19:12 ";
#endif /* not lint */
#else
__RCSID("$NetBSD: search.c,v 1.4 2017/11/22 16:17:30 rin Exp $");
__RCSID("$NetBSD: search.c,v 1.4.6.1 2023/02/24 13:06:48 martin Exp $");
#endif
#include <sys/types.h>
@ -110,9 +110,14 @@ prev: if (sp->re == NULL) {
++p;
break;
}
if (plen > 1 && p[0] == '\\' && p[1] == delim) {
++p;
--plen;
if (plen > 1 && p[0] == '\\') {
if(p[1] == delim) {
++p;
--plen;
} else if(p[1] == '\\') {
*t++ = *p++;
--plen;
}
}
}
if (epp != NULL)