aboutsummaryrefslogtreecommitdiffstats
path: root/pbx.c
diff options
context:
space:
mode:
authortilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b>2006-03-21 05:48:17 +0000
committertilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b>2006-03-21 05:48:17 +0000
commita991aeeac69e289a0a43b2cee8c67ed6a7ede310 (patch)
treeaab4574c4547e96264c378e4b830260a6ba81d75 /pbx.c
parent8e27b3d7254154058d5f22ed87c5174bc1de27fa (diff)
Bug 6745 - Fix for ranges that wrap around the ends
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@13709 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'pbx.c')
-rw-r--r--pbx.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/pbx.c b/pbx.c
index b355abe04..197175c1e 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;
}