]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
build: GCC 5.1.x catches some new const, array bounds and missing paren issues 23/1523/1
authorGeorge Joseph <george.joseph@fairview5.com>
Sat, 24 Oct 2015 18:08:41 +0000 (12:08 -0600)
committerGeorge Joseph <george.joseph@fairview5.com>
Sat, 24 Oct 2015 18:50:40 +0000 (12:50 -0600)
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
channels/sig_pri.c

index 248a7fd10705fb5b4afbbb80c4b39084b2b5783c..ef0ad651a4c92872db4c6f2b2b51ccd7e3219696 100644 (file)
@@ -18833,6 +18833,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) {
index 4b913910160c8f1e2f0b4c8abbef0ca894dd2913..d6b85072550999fd03d598b1ac330b0564bedfcd 100644 (file)
@@ -4682,7 +4682,7 @@ static void sig_pri_handle_subcmds(struct sig_pri_span *pri, int chanpos, int ev
                                        f.frametype = AST_FRAME_TEXT;
                                        f.subclass.integer = 0;
                                        f.offset = 0;
-                                       f.data.ptr = &subcmd->u.display.text;
+                                       f.data.ptr = (void *)&subcmd->u.display.text;
                                        f.datalen = subcmd->u.display.length + 1;
                                        ast_queue_frame(owner, &f);
                                        ast_channel_unlock(owner);