From a605bd8498ead542405941c1f722b3b4080ad6ed Mon Sep 17 00:00:00 2001 From: Yeshwanth Reddivari Date: Mon, 9 Nov 2015 16:10:59 -0800 Subject: [PATCH] evil: avoid SIGSEV while using strlen function Summary: Assertion of (fp!=NULL) should be done before passing fp to strlen funcion Reviewers: singh.amitesh, Hermet, alok25, mvsovani, vtorri Subscribers: sachin.dev, cedric Differential Revision: https://phab.enlightenment.org/D3274 Signed-off-by: Cedric BAIL --- src/lib/evil/regex/regcomp.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/lib/evil/regex/regcomp.c b/src/lib/evil/regex/regcomp.c index 080d292..c1b7850 100644 --- a/src/lib/evil/regex/regcomp.c +++ b/src/lib/evil/regex/regcomp.c @@ -1179,9 +1179,10 @@ register cset *cs; register char *cp; { register char *fp = mcfind(cs, cp); - register size_t len = strlen(fp); + register size_t len; assert(fp != NULL); + len = strlen(fp); (void) memmove(fp, fp + len + 1, cs->smultis - (fp + len + 1 - cs->multis)); cs->smultis -= len; -- 2.7.4