]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Guard against division by zero.
authorTilghman Lesher <tilghman@meg.abyt.es>
Thu, 21 Jan 2010 05:53:17 +0000 (05:53 +0000)
committerTilghman Lesher <tilghman@meg.abyt.es>
Thu, 21 Jan 2010 05:53:17 +0000 (05:53 +0000)
git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@241765 65c4cc65-6c06-0410-ace0-fbb531ad65f3

funcs/func_math.c

index 76d9deff608f8bc924ddef53506d915a220f8572..18a2bd7a90f778a5820a8dd2c69aa56b2c38c048 100644 (file)
@@ -199,7 +199,11 @@ static int math(struct ast_channel *chan, char *cmd, char *parse,
                        int inum1 = fnum1;
                        int inum2 = fnum2;
 
-                       ftmp = (inum1 % inum2);
+                       if (inum2 == 0) {
+                               ftmp = 0;
+                       } else {
+                               ftmp = (inum1 % inum2);
+                       }
 
                        break;
                }