]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
chan_dahdi.c: Fix bounds check regression. 29/4629/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:22:56 +0000 (14:22 -0600)
Caused by ASTERISK-25494

Change-Id: I1fc408c1a083745ff59da5c4113041bbfce54bcb

channels/chan_dahdi.c

index 2e139a2342891a1f5852aaa3abb6d800b2ed71fc..6d740d064b6c8fee1926189bd3750466248c7901 100644 (file)
@@ -18905,8 +18905,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 */