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
This commit is contained in:
Mark Johnston 2013-01-05 22:04:40 +00:00
parent 7c3b94cfea
commit f46b2b9f64
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=245075

View File

@ -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; \