<p>Friendly Automation <strong>submitted</strong> this change.</p><p><a href="https://gerrit.asterisk.org/c/asterisk/+/14930">View Change</a></p><div style="white-space:pre-wrap">Approvals:
  Joshua Colp: Looks good to me, but someone else must approve
  George Joseph: Looks good to me, approved
  Friendly Automation: Approved for Submit

</div><pre style="font-family: monospace,monospace; white-space: pre-wrap;">func_curl.c: Prevent crash when using CURLOPT(httpheader)<br><br>Because we use shared thread-local cURL instances, we need to ensure<br>that the state of the cURL instance is correct before each invocation.<br><br>In the case of custom headers, we were not resetting cURL's internal<br>HTTP header pointer which could result in a crash if subsequent<br>requests do not configure custom headers.<br><br>ASTERISK-29085 #close<br><br>Change-Id: I8b4ab34038156dfba613030a45f10e932d2e992d<br>---<br>M funcs/func_curl.c<br>1 file changed, 4 insertions(+), 3 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/funcs/func_curl.c b/funcs/func_curl.c</span><br><span>index b6b6181..3016cc8 100644</span><br><span>--- a/funcs/func_curl.c</span><br><span>+++ b/funcs/func_curl.c</span><br><span>@@ -705,9 +705,10 @@</span><br><span>               curl_easy_setopt(*curl, CURLOPT_POSTFIELDS, args.postdata);</span><br><span>  }</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-   if (headers) {</span><br><span style="color: hsl(0, 100%, 40%);">-          curl_easy_setopt(*curl, CURLOPT_HTTPHEADER, headers);</span><br><span style="color: hsl(0, 100%, 40%);">-   }</span><br><span style="color: hsl(120, 100%, 40%);">+     /* Always assign the headers - even when NULL - in case we had</span><br><span style="color: hsl(120, 100%, 40%);">+         * custom headers the last time we used this shared cURL</span><br><span style="color: hsl(120, 100%, 40%);">+       * instance */</span><br><span style="color: hsl(120, 100%, 40%);">+        curl_easy_setopt(*curl, CURLOPT_HTTPHEADER, headers);</span><br><span> </span><br><span>    /* Temporarily assign a buffer for curl to write errors to. */</span><br><span>       curl_errbuf[0] = curl_errbuf[CURL_ERROR_SIZE] = '\0';</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/c/asterisk/+/14930">change 14930</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/+/14930"/><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: I8b4ab34038156dfba613030a45f10e932d2e992d </div>
<div style="display:none"> Gerrit-Change-Number: 14930 </div>
<div style="display:none"> Gerrit-PatchSet: 2 </div>
<div style="display:none"> Gerrit-Owner: Sean Bright <sean.bright@gmail.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@sangoma.com> </div>
<div style="display:none"> Gerrit-MessageType: merged </div>