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

index bcbcfa344cd7c7f355fffb3c46b3a6652c534e41..231a52f2252b07b655a2613a5f4019c822ab4c91 100644 (file)
@@ -18452,6 +18452,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 d9b25779eaf3a5f0d0db34f007878dcec949f328..d401400e7f9fa60c3d828a42851b21a6c2aa7e8f 100644 (file)
@@ -4374,7 +4374,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 dce5fe0361481c248d93e664b967e63506287b25..efd960e03872a1979a0c0f9b0b0d762e049f6d93 100644 (file)
@@ -4517,7 +4517,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);