From 431a247538dfc2a9761a7aed0d68bba3a45d8766 Mon Sep 17 00:00:00 2001 From: Tilghman Lesher Date: Thu, 21 Jan 2010 05:55:53 +0000 Subject: [PATCH] Merged revisions 241766 via svnmerge from https://origsvn.digium.com/svn/asterisk/trunk ................ r241766 | tilghman | 2010-01-20 23:54:30 -0600 (Wed, 20 Jan 2010) | 9 lines Merged revisions 241765 via svnmerge from 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/branches/1.6.0@241767 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- funcs/func_math.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/funcs/func_math.c b/funcs/func_math.c index 663cc5daf4..d4d0cb1dcd 100644 --- a/funcs/func_math.c +++ b/funcs/func_math.c @@ -224,7 +224,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; }