Author: markj
Date: Sat Jan  5 22:04:40 2013
New Revision: 245075
URL: http://svnweb.freebsd.org/changeset/base/245075

Log:
  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

Modified:
  head/usr.bin/grep/regex/tre-fastmatch.c

Modified: head/usr.bin/grep/regex/tre-fastmatch.c
==============================================================================
--- head/usr.bin/grep/regex/tre-fastmatch.c     Sat Jan  5 21:52:38 2013        
(r245074)
+++ head/usr.bin/grep/regex/tre-fastmatch.c     Sat Jan  5 22:04:40 2013        
(r245075)
@@ -468,7 +468,7 @@ static int  fastcmp(const fastmatch_t *fg
   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;                                               \
_______________________________________________
[email protected] mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "[email protected]"

Reply via email to