From 81f2817267430897c8364105226ec7996c80436d Mon Sep 17 00:00:00 2001 From: Mark McLarnon Date: Thu, 17 Feb 2022 19:39:10 -0500 Subject: [PATCH] implements fixes from https://github.com/jruizgit/rules/pull/386 --- src/rules/events.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/rules/events.c b/src/rules/events.c index 25d62c7..2636e98 100644 --- a/src/rules/events.c +++ b/src/rules/events.c @@ -609,10 +609,10 @@ static unsigned int reduceExpressionSequence(ruleset *tree, } - if ((operator == OP_AND && !targetProperty->value.b) || - (operator == OP_OR && targetProperty->value.b)) { - while (currentExpression->operator != OP_END) { - ++*i; + if ((((operator == OP_AND) && !targetProperty->value.b) || + ((operator == OP_OR) && targetProperty->value.b)) + && (*i < exprs->length)) { + while ((currentExpression->operator != OP_END) && (++*i < exprs->length)) { currentExpression = &exprs->expressions[*i]; } return RULES_OK;