]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
build: GCC 5.1.x catches some new const, array bounds and missing paren issues 25/1525/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 21:12:27 +0000 (15:12 -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/chan_skinny.c
channels/sig_pri.c

index 2dbeeaa73f4dc988affdcdb70940c177bb740237..f8ded8c94882294ccbb08da9138edea6e0ca04c0 100644 (file)
@@ -18618,6 +18618,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 9462eb685c376a4df66f04202561db0ae029bf27..4004a470c8031fb4951e81b03856dae370be5908 100644 (file)
@@ -4379,7 +4379,7 @@ static int skinny_call(struct ast_channel *ast, const char *dest, int timeout)
 
        AST_LIST_TRAVERSE(ast_channel_varshead(ast), current, entries) {
                if (!(strcasecmp(ast_var_name(current),"SKINNY_AUTOANSWER"))) {
-                       if (d->hookstate == SKINNY_ONHOOK && !sub->aa_sched < 0) {
+                       if (d->hookstate == SKINNY_ONHOOK && !(sub->aa_sched < 0)) {
                                char buf[24];
                                int aatime;
                                char *stringp = buf, *curstr;
index 15a50c4042da3c80080baf5c9cada5e5e6445182..cbd4068ca6c61b3255c872475c745d353a4c0ae8 100644 (file)
@@ -4500,7 +4500,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);