summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPetre Rodan <2b4eda@subdimension.ro>2023-10-11 19:05:22 +0300
committerPetre Rodan <2b4eda@subdimension.ro>2023-10-11 19:05:22 +0300
commitb34434f7b94862194d14674e702e8a3226181b86 (patch)
tree28ff223f895ed8003531e41c032e727e0ebebf09
parent48c4ae4742542f0c4d0c43993871f4c649f39f38 (diff)
ifparser.c: divide-by-zero fix
-rw-r--r--ifparser.c5
1 files changed, 4 insertions, 1 deletions
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;