From: Tilghman Lesher Date: Thu, 21 Jan 2010 05:53:17 +0000 (+0000) Subject: Guard against division by zero. X-Git-Tag: 1.4.30-rc2~5^2~24 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=df56d04848335edb1fd5c33c27678ba682eb29d1;p=thirdparty%2Fasterisk.git Guard against division by zero. git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@241765 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- diff --git a/funcs/func_math.c b/funcs/func_math.c index 76d9deff60..18a2bd7a90 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; }