Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 21 Feb 2015 15:02:28 +0000 (UTC)
From:      "Pedro F. Giffuni" <pfg@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r279104 - head/lib/libc/regex
Message-ID:  <201502211502.t1LF2SYo098760@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201502211502.t1LF2SYo098760>