<p>Kevin Harwell <strong>submitted</strong> this change.</p><p><a href="https://gerrit.asterisk.org/c/asterisk/+/13948">View Change</a></p><div style="white-space:pre-wrap">Approvals:
Joshua Colp: Looks good to me, but someone else must approve
Kevin Harwell: Looks good to me, approved; Approved for Submit
George Joseph: Looks good to me, but someone else must approve
</div><pre style="font-family: monospace,monospace; white-space: pre-wrap;">dundi: fix NULL dereference.<br><br>If a negative (error) return is received from dundi_lookup_internal,<br>this is not handled correctly when assigning the result to the buffer.<br>As such, use a signed integer in the assignment and do a proper<br>comparison.<br><br>ASTERISK-21205<br><br>Change-Id: I5214ebb6491e2bd14f90c7d3ce229da86888f739<br>---<br>M pbx/pbx_dundi.c<br>1 file changed, 3 insertions(+), 3 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/pbx/pbx_dundi.c b/pbx/pbx_dundi.c</span><br><span>index 6cc7711..1ab0676 100644</span><br><span>--- a/pbx/pbx_dundi.c</span><br><span>+++ b/pbx/pbx_dundi.c</span><br><span>@@ -4193,7 +4193,7 @@</span><br><span> </span><br><span> struct dundi_result_datastore {</span><br><span> struct dundi_result results[MAX_RESULTS];</span><br><span style="color: hsl(0, 100%, 40%);">- unsigned int num_results;</span><br><span style="color: hsl(120, 100%, 40%);">+ int num_results;</span><br><span> unsigned int id;</span><br><span> };</span><br><span> </span><br><span>@@ -4325,7 +4325,7 @@</span><br><span> drds = datastore->data;</span><br><span> </span><br><span> if (!strcasecmp(args.resultnum, "getnum")) {</span><br><span style="color: hsl(0, 100%, 40%);">- snprintf(buf, len, "%u", drds->num_results);</span><br><span style="color: hsl(120, 100%, 40%);">+ snprintf(buf, len, "%d", drds->num_results < 0 ? 0 : drds->num_results);</span><br><span> res = 0;</span><br><span> goto finish;</span><br><span> }</span><br><span>@@ -4336,7 +4336,7 @@</span><br><span> goto finish;</span><br><span> }</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">- if (num && num <= drds->num_results) {</span><br><span style="color: hsl(120, 100%, 40%);">+ if (num && drds->num_results > 0 && num <= drds->num_results) {</span><br><span> snprintf(buf, len, "%s/%s", drds->results[num - 1].tech, drds->results[num - 1].dest);</span><br><span> res = 0;</span><br><span> } else</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/c/asterisk/+/13948">change 13948</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/+/13948"/><meta itemprop="name" content="View Change"/></div></div>
<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-Change-Id: I5214ebb6491e2bd14f90c7d3ce229da86888f739 </div>
<div style="display:none"> Gerrit-Change-Number: 13948 </div>
<div style="display:none"> Gerrit-PatchSet: 3 </div>
<div style="display:none"> Gerrit-Owner: Jaco Kroon <jaco@uls.co.za> </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@sangoma.com> </div>
<div style="display:none"> Gerrit-Reviewer: Kevin Harwell <kharwell@digium.com> </div>
<div style="display:none"> Gerrit-MessageType: merged </div>