[Asterisk-code-review] build: GCC 5.1.x catches some new const, array bounds and mi... (asterisk[11])

Joshua Colp asteriskteam at digium.com
Mon Oct 26 11:27:44 CDT 2015


Joshua Colp has submitted this change and it was merged.

Change subject: build: GCC 5.1.x catches some new const, array bounds and missing paren issues
......................................................................


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
---
M channels/chan_dahdi.c
M channels/chan_skinny.c
M channels/sig_pri.c
3 files changed, 7 insertions(+), 2 deletions(-)

Approvals:
  Richard Mudgett: Looks good to me, but someone else must approve
  Anonymous Coward #1000019: Verified
  Matt Jordan: Looks good to me, but someone else must approve
  Joshua Colp: Looks good to me, approved



diff --git a/channels/chan_dahdi.c b/channels/chan_dahdi.c
index 2dbeeaa..f8ded8c 100644
--- a/channels/chan_dahdi.c
+++ b/channels/chan_dahdi.c
@@ -18618,6 +18618,11 @@
 					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) {
diff --git a/channels/chan_skinny.c b/channels/chan_skinny.c
index 9462eb6..4004a47 100644
--- a/channels/chan_skinny.c
+++ b/channels/chan_skinny.c
@@ -4379,7 +4379,7 @@
 
 	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;
diff --git a/channels/sig_pri.c b/channels/sig_pri.c
index 15a50c4..cbd4068 100644
--- a/channels/sig_pri.c
+++ b/channels/sig_pri.c
@@ -4500,7 +4500,7 @@
 					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);

-- 
To view, visit https://gerrit.asterisk.org/1525
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I818f149cd66a93b062df421e1c73c7942f5a4a77
Gerrit-PatchSet: 1
Gerrit-Project: asterisk
Gerrit-Branch: 11
Gerrit-Owner: George Joseph <george.joseph at fairview5.com>
Gerrit-Reviewer: Anonymous Coward #1000019
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Matt Jordan <mjordan at digium.com>
Gerrit-Reviewer: Richard Mudgett <rmudgett at digium.com>



More information about the asterisk-code-review mailing list