From fe4dd0255ea796e64599c0fc28e6900fbc07e6aa Mon Sep 17 00:00:00 2001 From: Marko Kreen Date: Tue, 30 Dec 2014 15:18:52 +0200 Subject: [PATCH] regex: simplify op_count_full error check There was dummy loop with size limit for "performace" reasons, but it triggered automatic checkers. Remove complexity by using strchr() there. Reported-By: David Binderman --- usual/regex.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/usual/regex.c b/usual/regex.c index 28fbca7..a500fbb 100644 --- a/usual/regex.c +++ b/usual/regex.c @@ -315,11 +315,7 @@ static int op_count_full(struct ParseCtx *ctx, const char **re) } /* bad fmt, decide between error codes */ - for (a = 0; end[a] && a < 5; a++) { - if (end[a] == '}') - return REG_BADBR; - } - return REG_EBRACE; + return strchr(end, '}') ? REG_BADBR : REG_EBRACE; done: ctx->last_elem->mincnt = a; -- 2.30.2