From: George Joseph Date: Wed, 11 Oct 2017 12:03:41 +0000 (-0600) Subject: chan_vpb: Fix a gcc 7 out-of-bounds complaint X-Git-Tag: 13.18.0-rc1~7^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f3f141781cb7f17faa26a0a8a50fa05609a0f2b6;p=thirdparty%2Fasterisk.git 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 --- diff --git a/channels/chan_vpb.cc b/channels/chan_vpb.cc index 0f050a8377..da02ff3e88 100644 --- a/channels/chan_vpb.cc +++ b/channels/chan_vpb.cc @@ -1785,7 +1785,7 @@ static int vpb_digit_end(struct ast_channel *ast, char digit, unsigned int durat 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);