From cc3a001f1c7ae108932d77e8142be33edc7cf1d2 Mon Sep 17 00:00:00 2001 From: "Pedro F. Giffuni" Date: Sat, 21 Feb 2015 15:02:27 +0000 Subject: [PATCH] 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. --- lib/libc/regex/engine.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/libc/regex/engine.c b/lib/libc/regex/engine.c index 8fc67ce659d..436370d0f6a 100644 --- a/lib/libc/regex/engine.c +++ b/lib/libc/regex/engine.c @@ -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);