diff --git a/pbx.c b/pbx.c
index a70f922fca462c436563a6f2d647863bd317ec25..38c6e5d5d7ba0839dda0c6563e882f9cbcaf6242 100644
--- a/pbx.c
+++ b/pbx.c
@@ -3748,7 +3748,7 @@ static unsigned get_range(char *src, int max, char *const names[], const char *m
 	}
 	/* Fill the mask. Remember that ranges are cyclic */
 	mask = 1 << s;	/* last element in case s == e */
-	for ( ; s!=e; s++) {
+	for ( ; s<=e; s++) {
 		if (s == max)
 			s = 0 ;
 		mask |= (1 << s);