From: Tilghman Lesher Date: Tue, 21 Mar 2006 05:48:17 +0000 (+0000) Subject: Bug 6745 - Fix for ranges that wrap around the ends X-Git-Tag: 1.4.0-beta1~2381 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=96ec20c0fc8ad97a61b6f9c8fc14b084e52fef0b;p=thirdparty%2Fasterisk.git Bug 6745 - Fix for ranges that wrap around the ends git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@13709 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- diff --git a/pbx.c b/pbx.c index b355abe044..197175c1ed 100644 --- a/pbx.c +++ b/pbx.c @@ -3728,10 +3728,14 @@ static unsigned get_range(char *src, int max, char *const names[], const char *m } /* Fill the mask. Remember that ranges are cyclic */ mask = 1 << e; /* initialize with last element */ - for ( ; s != e; s++) { - if (s == max) - s = 0 ; - mask |= (1 << s); + while (s != e) { + if (s >= max) { + s = 0; + mask |= (1 << s); + } else { + mask |= (1 << s); + s++; + } } return mask; }