X-Git-Url: https://git.exim.org/exim.git/blobdiff_plain/1ba28e2b955b005ce4825fec792df17f75a8de1e..a5b5269546e02d1f2e90000e79df8409d4f269db:/src/src/expand.c diff --git a/src/src/expand.c b/src/src/expand.c index bf425ae81..fece8c150 100644 --- a/src/src/expand.c +++ b/src/src/expand.c @@ -3106,9 +3106,21 @@ if (*error == NULL) int op = *s++; int y = eval_op_unary(&s, decimal, error); if (*error != NULL) break; - if (op == '*') x *= y; - else if (op == '/') x /= y; - else x %= y; + if (op == '*') + x *= y; + else + { + if (y == 0) + { + *error = (op == '/') ? US"divide by zero" : US"modulo by zero"; + x = 0; + break; + } + if (op == '/') + x /= y; + else + x %= y; + } } } *sptr = s;