From 4328d320c2aba32b7848b46a8963fbb7308a18c2 Mon Sep 17 00:00:00 2001 From: George Joseph Date: Sat, 24 Oct 2015 12:08:41 -0600 Subject: build: GCC 5.1.x catches some new const, array bounds and missing paren issues Fixed 1 issue in each of the affected files. ASTERISK-25494 #close Reported-by: George Joseph Tested-by: George Joseph Change-Id: I818f149cd66a93b062df421e1c73c7942f5a4a77 --- channels/chan_dahdi.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'channels/chan_dahdi.c') diff --git a/channels/chan_dahdi.c b/channels/chan_dahdi.c index c17e4f891..697c720e3 100644 --- a/channels/chan_dahdi.c +++ b/channels/chan_dahdi.c @@ -18832,6 +18832,11 @@ static int process_dahdi(struct dahdi_chan_conf *confp, const char *cat, struct cadence_is_ok = 0; } + /* 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; + } + /* Ring cadences cannot be negative */ for (i = 0; i < element_count; i++) { if (c[i] == 0) { -- cgit v1.2.3