svn commit: r246920 - stable/9/usr.bin/grep/regex

Mark Johnston markj at FreeBSD.org
Sun Feb 17 19:50:00 UTC 2013


Author: markj
Date: Sun Feb 17 19:49:59 2013
New Revision: 246920
URL: http://svnweb.freebsd.org/changeset/base/246920

Log:
  MFC r245075:
    Fix a segfault when bsdgrep -i is given an empty pattern string.
  
  Approved by:	emaste (co-mentor)

Modified:
  stable/9/usr.bin/grep/regex/tre-fastmatch.c
Directory Properties:
  stable/9/usr.bin/grep/   (props changed)

Modified: stable/9/usr.bin/grep/regex/tre-fastmatch.c
==============================================================================
--- stable/9/usr.bin/grep/regex/tre-fastmatch.c	Sun Feb 17 19:49:29 2013	(r246919)
+++ stable/9/usr.bin/grep/regex/tre-fastmatch.c	Sun Feb 17 19:49:59 2013	(r246920)
@@ -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;						\


More information about the svn-src-stable-9 mailing list