From: Phil Pennock Date: Tue, 12 Apr 2011 08:24:12 +0000 (-0400) Subject: Catch divide-by-zero in ${eval:...}. X-Git-Tag: exim-4_76_RC1~5 X-Git-Url: https://vcs.fsf.org/?p=exim.git;a=commitdiff_plain;h=54e7ce4ad20a6977ee895a358259122bf3630090 Catch divide-by-zero in ${eval:...}. Fixes 1102 --- diff --git a/doc/doc-txt/ChangeLog b/doc/doc-txt/ChangeLog index ce78086a6..e6684b4e3 100644 --- a/doc/doc-txt/ChangeLog +++ b/doc/doc-txt/ChangeLog @@ -21,6 +21,9 @@ PP/05 Don't segfault on misconfiguration of ref:name exim-user as uid. PP/06 Extra paranoia around buffer usage at the STARTTLS transition. nb: Exim is not vulnerable to http://www.kb.cert.org/vuls/id/555316 +PP/07 Catch divide-by-zero in ${eval:...}. + Fixes bugzilla 1102. + Exim version 4.75 ----------------- diff --git a/src/src/expand.c b/src/src/expand.c index bf425ae81..06e0eb0ce 100644 --- a/src/src/expand.c +++ b/src/src/expand.c @@ -3107,7 +3107,16 @@ if (*error == NULL) int y = eval_op_unary(&s, decimal, error); if (*error != NULL) break; if (op == '*') x *= y; - else if (op == '/') x /= y; + else if (op == '/') + { + if (y == 0) + { + *error = US"divide by zero"; + x = 0; + break; + } + x /= y; + } else x %= y; } }