Author: pfg
Date: Sat Feb 21 15:02:27 2015
New Revision: 279104
URL: https://svnweb.freebsd.org/changeset/base/279104

Log:
  Prevent NULL pointer de-reference.
  
  As a follow up to r279090, if dp hasn't been defined, we
  shouldn't attempt to do an optimization here.

Modified:
  head/lib/libc/regex/engine.c

Modified: head/lib/libc/regex/engine.c
==============================================================================
--- head/lib/libc/regex/engine.c        Sat Feb 21 13:00:52 2015        
(r279103)
+++ head/lib/libc/regex/engine.c        Sat Feb 21 15:02:27 2015        
(r279104)
@@ -244,7 +244,7 @@ matcher(struct re_guts *g,
        ZAPSTATE(&m->mbs);
 
        /* Adjust start according to moffset, to speed things up */
-       if (g->moffset > -1)
+       if (dp != NULL && g->moffset > -1)
                start = ((dp - g->moffset) < start) ? start : dp - g->moffset;
 
        SP("mloop", m->st, *start);
_______________________________________________
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to