[exim-dev] [Bug 1102] Exim should not abort on divide-by-zer…

Startseite
Nachricht löschen
Nachricht beantworten
Autor: Git Commit
Datum:  
To: exim-dev
Alte Treads: [exim-dev] [Bug 1102] New: Divide by zero in eval/acl not reported in logs
Betreff: [exim-dev] [Bug 1102] Exim should not abort on divide-by-zero
------- You are receiving this mail because: -------
You are on the CC list for the bug.

http://bugs.exim.org/show_bug.cgi?id=1102

Git Commit <git@???> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |git@???





--- Comment #3 from Git Commit <git@???> 2011-04-12 10:17:05 ---
Git commit:
http://git.exim.org/exim.git/commitdiff/54e7ce4ad20a6977ee895a358259122bf3630090

commit 54e7ce4ad20a6977ee895a358259122bf3630090
Author:     Phil Pennock <pdp@???>
AuthorDate: Tue Apr 12 04:24:12 2011 -0400
Commit:     Phil Pennock <pdp@???>
CommitDate: Tue Apr 12 04:24:12 2011 -0400


    Catch divide-by-zero in ${eval:...}.


    Fixes 1102
---
 doc/doc-txt/ChangeLog |    3 +++
 src/src/expand.c      |   11 ++++++++++-
 2 files changed, 13 insertions(+), 1 deletions(-)


diff --git a/doc/doc-txt/ChangeLog b/doc/doc-txt/ChangeLog
index ce78086..e6684b4 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 bf425ae..06e0eb0 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;
     }
   }



--
Configure bugmail: http://bugs.exim.org/userprefs.cgi?tab=email