[asterisk-commits] chan vpb: Fix a gcc 7 out-of-bounds complaint (asterisk[master])

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Oct 11 17:06:18 CDT 2017


Joshua Colp has submitted this change and it was merged. ( https://gerrit.asterisk.org/6749 )

Change subject: chan_vpb:  Fix a gcc 7 out-of-bounds complaint
......................................................................

chan_vpb:  Fix a gcc 7 out-of-bounds complaint

chan_vpb was trying to use sizeof(*p->play_dtmf), where
p->play_dtmf is defined as char[16], to get the length of the array
but since p->play_dtmf is an actual array, sizeof(*p->play_dtmf)
returns the size of the first array element, which is 1.  gcc7
validly complains because the context in which it's used could
cause an out-of-bounds condition.

Change-Id: If9c4bfdb6b02fa72d39e0c09bf88900663c000ba
---
M channels/chan_vpb.cc
1 file changed, 1 insertion(+), 1 deletion(-)

Approvals:
  Joshua Colp: Looks good to me, but someone else must approve; Approved for Submit
  Richard Mudgett: Looks good to me, but someone else must approve
  Sean Bright: Looks good to me, approved



diff --git a/channels/chan_vpb.cc b/channels/chan_vpb.cc
index d7e9732..6e77dc2 100644
--- a/channels/chan_vpb.cc
+++ b/channels/chan_vpb.cc
@@ -1791,7 +1791,7 @@
 	ast_verb(4, "%s: vpb_digit: asked to play digit[%s]\n", p->dev, s);
 
 	ast_mutex_lock(&p->play_dtmf_lock);
-	strncat(p->play_dtmf, s, sizeof(*p->play_dtmf) - strlen(p->play_dtmf) - 1);
+	strncat(p->play_dtmf, s, sizeof(p->play_dtmf) - strlen(p->play_dtmf) - 1);
 	ast_mutex_unlock(&p->play_dtmf_lock);
 
 	ast_mutex_unlock(&p->lock);

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

Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: If9c4bfdb6b02fa72d39e0c09bf88900663c000ba
Gerrit-Change-Number: 6749
Gerrit-PatchSet: 1
Gerrit-Owner: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Jenkins2
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Richard Mudgett <rmudgett at digium.com>
Gerrit-Reviewer: Sean Bright <sean.bright at gmail.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-commits/attachments/20171011/3d410251/attachment-0001.html>


More information about the asterisk-commits mailing list