aboutsummaryrefslogtreecommitdiffstats
path: root/funcs
diff options
context:
space:
mode:
authortilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b>2010-01-21 05:53:17 +0000
committertilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b>2010-01-21 05:53:17 +0000
commit6458002f09e42034f0fa2e8b88f44063434e4881 (patch)
tree4c03485a8974c22c9ac595f88b35f03886b90dee /funcs
parentf3aeb941c2fb8875d0548ffcf9fff44011771418 (diff)
Guard against division by zero.
git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@241765 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'funcs')
-rw-r--r--funcs/func_math.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/funcs/func_math.c b/funcs/func_math.c
index 76d9deff6..18a2bd7a9 100644
--- a/funcs/func_math.c
+++ b/funcs/func_math.c
@@ -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;
}