X-Git-Url: https://git.exim.org/exim.git/blobdiff_plain/1ba28e2b955b005ce4825fec792df17f75a8de1e..5ee6f336ce27e7887fdc07ef45e0f3052d3893b0:/src/src/expand.c diff --git a/src/src/expand.c b/src/src/expand.c index bf425ae81..2e59c4084 100644 --- a/src/src/expand.c +++ b/src/src/expand.c @@ -2558,7 +2558,7 @@ switch(cond_type) "value \"%s\"", t); return NULL; } - if (yield != NULL) *yield = (boolvalue != 0); + if (yield != NULL) *yield = (boolvalue == testfor); return s; } @@ -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;