summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorguenther <guenther@openbsd.org>2014-05-23 19:49:15 +0000
committerguenther <guenther@openbsd.org>2014-05-23 19:49:15 +0000
commitd2a22d617da362b2fca8f24d577709d279b25c5b (patch)
tree9d260959a755eb8990142481205bc9533b22de03
parentMake the signal handler safe: block signals when updating data-structures (diff)
downloadwireguard-openbsd-d2a22d617da362b2fca8f24d577709d279b25c5b.tar.xz
wireguard-openbsd-d2a22d617da362b2fca8f24d577709d279b25c5b.zip
Use REG_STARTEND to permit searches to work past/across NUL bytes.
ok millert@ shadchin@
-rw-r--r--usr.bin/less/pattern.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/usr.bin/less/pattern.c b/usr.bin/less/pattern.c
index dc3ef786960..fd1fcf5f768 100644
--- a/usr.bin/less/pattern.c
+++ b/usr.bin/less/pattern.c
@@ -306,6 +306,11 @@ match_pattern(pattern, tpattern, line, line_len, sp, ep, notbol, search_type)
{
regmatch_t rm;
int flags = (notbol) ? REG_NOTBOL : 0;
+#ifdef REG_STARTEND
+ flags |= REG_STARTEND;
+ rm.rm_so = 0;
+ rm.rm_eo = line_len;
+#endif
matched = !regexec(spattern, line, 1, &rm, flags);
if (matched)
{