summaryrefslogtreecommitdiffstats
path: root/usr.bin/grep
diff options
context:
space:
mode:
authormarkj <markj@FreeBSD.org>2013-01-05 22:04:40 +0000
committermarkj <markj@FreeBSD.org>2013-01-05 22:04:40 +0000
commitcaa5b965eaffffc27e7d03470c2f9ba4badbbb40 (patch)
treee5b739ada877a27b539a3328c851900b70e14f43 /usr.bin/grep
parentaa8d1947b9017e09520e38f520fe26e4d03c80d6 (diff)
downloadFreeBSD-src-caa5b965eaffffc27e7d03470c2f9ba4badbbb40.zip
FreeBSD-src-caa5b965eaffffc27e7d03470c2f9ba4badbbb40.tar.gz
Fix a segfault when bsdgrep -i is given an empty pattern string.
PR: bin/172865 Reviewed by: gabor Approved by: emaste (co-mentor) MFC after: 1 week
Diffstat (limited to 'usr.bin/grep')
-rw-r--r--usr.bin/grep/regex/tre-fastmatch.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/usr.bin/grep/regex/tre-fastmatch.c b/usr.bin/grep/regex/tre-fastmatch.c
index 6f1aec6..b7a7c91 100644
--- a/usr.bin/grep/regex/tre-fastmatch.c
+++ b/usr.bin/grep/regex/tre-fastmatch.c
@@ -468,7 +468,7 @@ static int fastcmp(const fastmatch_t *fg, const void *data,
fg->nosub = (cflags & REG_NOSUB); \
\
/* Cannot handle REG_ICASE with MB string */ \
- if (fg->icase && (TRE_MB_CUR_MAX > 1)) \
+ if (fg->icase && (TRE_MB_CUR_MAX > 1) && n > 0) \
{ \
DPRINT(("Cannot use fast matcher for MBS with REG_ICASE\n")); \
return REG_BADPAT; \
OpenPOWER on IntegriCloud