svn commit: r279104 - head/lib/libc/regex

Pedro F. Giffuni pfg at FreeBSD.org
Sat Feb 21 15:02:28 UTC 2015


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);


More information about the svn-src-all mailing list