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

George Joseph asteriskteam at digium.com
Sat Oct 24 16:08:38 CDT 2015


George Joseph has uploaded a new change for review.

  https://gerrit.asterisk.org/1523

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/sig_pri.c
2 files changed, 6 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/23/1523/1

diff --git a/channels/chan_dahdi.c b/channels/chan_dahdi.c
index 248a7fd..ef0ad65 100644
--- a/channels/chan_dahdi.c
+++ b/channels/chan_dahdi.c
@@ -18833,6 +18833,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/sig_pri.c b/channels/sig_pri.c
index 4b91391..d6b8507 100644
--- a/channels/sig_pri.c
+++ b/channels/sig_pri.c
@@ -4682,7 +4682,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/1523
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I818f149cd66a93b062df421e1c73c7942f5a4a77
Gerrit-PatchSet: 1
Gerrit-Project: asterisk
Gerrit-Branch: 13
Gerrit-Owner: George Joseph <george.joseph at fairview5.com>



More information about the asterisk-code-review mailing list