Merged revisions 241765 via svnmerge from
authorTilghman Lesher <tilghman@meg.abyt.es>
Thu, 21 Jan 2010 05:54:30 +0000 (05:54 +0000)
committerTilghman Lesher <tilghman@meg.abyt.es>
Thu, 21 Jan 2010 05:54:30 +0000 (05:54 +0000)
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r241765 | tilghman | 2010-01-20 23:53:17 -0600 (Wed, 20 Jan 2010) | 2 lines

  Guard against division by zero.
........

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@241766 65c4cc65-6c06-0410-ace0-fbb531ad65f3

funcs/func_math.c

index ab174d9..761c632 100644 (file)
@@ -289,7 +289,11 @@ static int math(struct ast_channel *chan, const char *cmd, char *parse,
                        int inum1 = fnum1;
                        int inum2 = fnum2;
 
-                       ftmp = (inum1 % inum2);
+                       if (inum2 == 0) {
+                               ftmp = 0;
+                       } else {
+                               ftmp = (inum1 % inum2);
+                       }
 
                        break;
                }