<p>George Joseph has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.asterisk.org/9467">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">manager: fix digest auth for ami/http mechanism.<br><br>Due to a fixed size buffer the digest authentication could be<br>incorrectly calculated if a large URI was provided, causing<br>authentication failure. The buffer is now dynamically allocated to allow<br>any size URI within the normal limits of the HTTP request size.<br><br>ASTERISK-27841<br><br>Change-Id: I660609db13b8f9e5f9567f339dd804f4985d41b3<br>---<br>M main/manager.c<br>1 file changed, 9 insertions(+), 2 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/67/9467/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/main/manager.c b/main/manager.c</span><br><span>index 1e60003..46bc440 100644</span><br><span>--- a/main/manager.c</span><br><span>+++ b/main/manager.c</span><br><span>@@ -7988,13 +7988,20 @@</span><br><span> </span><br><span>   /* compute the expected response to compare with what we received */</span><br><span>         {</span><br><span style="color: hsl(0, 100%, 40%);">-               char a2[256];</span><br><span style="color: hsl(120, 100%, 40%);">+         char *a2;</span><br><span>            char a2_hash[256];</span><br><span>           char resp[256];</span><br><span> </span><br><span>          /* XXX Now request method are hardcoded in A2 */</span><br><span style="color: hsl(0, 100%, 40%);">-                snprintf(a2, sizeof(a2), "%s:%s", ast_get_http_method(method), d.uri);</span><br><span style="color: hsl(120, 100%, 40%);">+              if (ast_asprintf(&a2, "%s:%s", ast_get_http_method(method), d.uri) < 0) {</span><br><span style="color: hsl(120, 100%, 40%);">+                    AST_RWLIST_UNLOCK(&users);</span><br><span style="color: hsl(120, 100%, 40%);">+                        ast_http_request_close_on_completion(ser);</span><br><span style="color: hsl(120, 100%, 40%);">+                    ast_http_error(ser, 500, "Server Error", "Internal Server Error (out of memory)");</span><br><span style="color: hsl(120, 100%, 40%);">+                        return 0;</span><br><span style="color: hsl(120, 100%, 40%);">+             }</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span>          ast_md5_hash(a2_hash, a2);</span><br><span style="color: hsl(120, 100%, 40%);">+            ast_free(a2);</span><br><span> </span><br><span>            if (d.qop) {</span><br><span>                         /* RFC 2617 */</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/9467">change 9467</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/9467"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: certified/13.21 </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>
<div style="display:none"> Gerrit-Change-Id: I660609db13b8f9e5f9567f339dd804f4985d41b3 </div>
<div style="display:none"> Gerrit-Change-Number: 9467 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: George Joseph <gjoseph@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Jaco Kroon <jaco@uls.co.za> </div>