Use REG_STARTEND to permit searches to work past/across NUL bytes.
authorguenther <guenther@openbsd.org>
Fri, 23 May 2014 19:49:15 +0000 (19:49 +0000)
committerguenther <guenther@openbsd.org>
Fri, 23 May 2014 19:49:15 +0000 (19:49 +0000)
ok millert@ shadchin@

usr.bin/less/pattern.c

index dc3ef78..fd1fcf5 100644 (file)
@@ -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)
                {