]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
chan_dahdi.c: Fix bounds check regression. 30/4630/1
authorRichard Mudgett <rmudgett@digium.com>
Wed, 14 Dec 2016 20:21:47 +0000 (14:21 -0600)
committerRichard Mudgett <rmudgett@digium.com>
Wed, 14 Dec 2016 20:24:07 +0000 (14:24 -0600)
Caused by ASTERISK-25494

Change-Id: I1fc408c1a083745ff59da5c4113041bbfce54bcb

channels/chan_dahdi.c

index 8cccf843b423ade742fce1eb1f0796419f0d02b0..71dbd35f19605f80e54e7b5aa45d6afdec8e38d3 100644 (file)
@@ -18902,8 +18902,8 @@ static int process_dahdi(struct dahdi_chan_conf *confp, const char *cat, struct
                                }
 
                                /* This check is only needed to satisfy the compiler that element_count can't cause an out of bounds */
-                               if (element_count >= ARRAY_LEN(c)) {
-                                       element_count = ARRAY_LEN(c) - 1;
+                               if (element_count > ARRAY_LEN(c)) {
+                                       element_count = ARRAY_LEN(c);
                                }
 
                                /* Ring cadences cannot be negative */