From b34434f7b94862194d14674e702e8a3226181b86 Mon Sep 17 00:00:00 2001 From: Petre Rodan <2b4eda@subdimension.ro> Date: Wed, 11 Oct 2023 19:05:22 +0300 Subject: ifparser.c: divide-by-zero fix --- ifparser.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'ifparser.c') diff --git a/ifparser.c b/ifparser.c index 631b4f0..42138f8 100644 --- a/ifparser.c +++ b/ifparser.c @@ -338,7 +338,10 @@ parse_product(IfParser *g, const char *cp, long *valp) case '%': DO(cp = parse_product(g, cp + 1, &rightval)); - *valp = (*valp % rightval); + if (rightval) + *valp = (*valp % rightval); + else + *valp = LONG_MAX; break; } return cp; -- cgit v1.2.3