<p>George Joseph <strong>merged</strong> this change.</p><p><a href="https://gerrit.asterisk.org/c/asterisk/+/11474">View Change</a></p><div style="white-space:pre-wrap">Approvals:
Kevin Harwell: Looks good to me, but someone else must approve
Joshua Colp: Looks good to me, but someone else must approve
George Joseph: Looks good to me, approved; Approved for Submit
</div><pre style="font-family: monospace,monospace; white-space: pre-wrap;">chan_dahdi: Address gcc9 issues<br><br>Fixed format-truncation issues in chan_dahdi.c and<br>sig_analog.c. Since they're related to fields provided<br>by dahdi-tools we can't change the buffer sizes so we're just<br>checking the return from snprintf and printing an errior if we<br>overflow.<br><br>Change-Id: Idc1f3c1565b88a7d145332a0196074b5832864e5<br>---<br>M channels/chan_dahdi.c<br>M channels/sig_analog.c<br>2 files changed, 16 insertions(+), 3 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/channels/chan_dahdi.c b/channels/chan_dahdi.c</span><br><span>index d425b32..8b70447 100644</span><br><span>--- a/channels/chan_dahdi.c</span><br><span>+++ b/channels/chan_dahdi.c</span><br><span>@@ -7740,8 +7740,16 @@</span><br><span> c++;</span><br><span> else</span><br><span> c = p->dialdest;</span><br><span style="color: hsl(0, 100%, 40%);">- if (*c) snprintf(p->dop.dialstr, sizeof(p->dop.dialstr), "M*0%s#", c);</span><br><span style="color: hsl(0, 100%, 40%);">- else ast_copy_string(p->dop.dialstr,"M*2#", sizeof(p->dop.dialstr));</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ if (*c) {</span><br><span style="color: hsl(120, 100%, 40%);">+ int numchars = snprintf(p->dop.dialstr, sizeof(p->dop.dialstr), "M*0%s#", c);</span><br><span style="color: hsl(120, 100%, 40%);">+ if (numchars >= sizeof(p->dop.dialstr)) {</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_log(LOG_WARNING, "Dial string '%s' truncated\n", c);</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span style="color: hsl(120, 100%, 40%);">+ } else {</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_copy_string(p->dop.dialstr,"M*2#", sizeof(p->dop.dialstr));</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span> if (strlen(p->dop.dialstr) > 4) {</span><br><span> memset(p->echorest, 'w', sizeof(p->echorest) - 1);</span><br><span> strcpy(p->echorest + (p->echotraining / 401) + 1, p->dop.dialstr + strlen(p->dop.dialstr) - 2);</span><br><span>diff --git a/channels/sig_analog.c b/channels/sig_analog.c</span><br><span>index ea0c31d..c2e3e49 100644</span><br><span>--- a/channels/sig_analog.c</span><br><span>+++ b/channels/sig_analog.c</span><br><span>@@ -2957,11 +2957,16 @@</span><br><span> } else {</span><br><span> c = p->dialdest;</span><br><span> }</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span> if (*c) {</span><br><span style="color: hsl(0, 100%, 40%);">- snprintf(p->dop.dialstr, sizeof(p->dop.dialstr), "M*0%s#", c);</span><br><span style="color: hsl(120, 100%, 40%);">+ int numchars = snprintf(p->dop.dialstr, sizeof(p->dop.dialstr), "M*0%s#", c);</span><br><span style="color: hsl(120, 100%, 40%);">+ if (numchars >= sizeof(p->dop.dialstr)) {</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_log(LOG_WARNING, "Dial string '%s' truncated\n", c);</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span> } else {</span><br><span> ast_copy_string(p->dop.dialstr,"M*2#", sizeof(p->dop.dialstr));</span><br><span> }</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span> if (strlen(p->dop.dialstr) > 4) {</span><br><span> memset(p->echorest, 'w', sizeof(p->echorest) - 1);</span><br><span> strcpy(p->echorest + (p->echotraining / 401) + 1, p->dop.dialstr + strlen(p->dop.dialstr) - 2);</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/c/asterisk/+/11474">change 11474</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://gerrit.asterisk.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.asterisk.org/c/asterisk/+/11474"/><meta itemprop="name" content="View Change"/></div></div>
<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: 13 </div>
<div style="display:none"> Gerrit-Change-Id: Idc1f3c1565b88a7d145332a0196074b5832864e5 </div>
<div style="display:none"> Gerrit-Change-Number: 11474 </div>
<div style="display:none"> Gerrit-PatchSet: 2 </div>
<div style="display:none"> Gerrit-Owner: George Joseph <gjoseph@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Friendly Automation </div>
<div style="display:none"> Gerrit-Reviewer: George Joseph <gjoseph@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Joshua Colp <jcolp@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Kevin Harwell <kharwell@digium.com> </div>
<div style="display:none"> Gerrit-MessageType: merged </div>