<p style="white-space: pre-wrap; word-wrap: break-word;">Thanks for the comments, it should be better now. Fun fact, I ran valgrind to try and see if I got some other buffer calculation wrong and found a bug in websocket_read_string, but, unrelated to this patch. I don't think we want to solve it here.</p><p style="white-space: pre-wrap; word-wrap: break-word;">This ast_copy_string seems to be copying one byte more over the payload:</p><p style="white-space: pre-wrap; word-wrap: break-word;">https://github.com/asterisk/asterisk/blob/master/res/res_http_websocket.c#L1439</p><p><a href="https://gerrit.asterisk.org/c/asterisk/+/14520">View Change</a></p><p>1 comment:</p><ul style="list-style: none; padding: 0;"><li style="margin: 0; padding: 0;"><p><a href="https://gerrit.asterisk.org/c/asterisk/+/14520/1/res/res_http_websocket.c">File res/res_http_websocket.c:</a></p><ul style="list-style: none; padding: 0;"><li style="margin: 0; padding: 0 0 0 16px;"><p style="margin-bottom: 4px;"><a href="https://gerrit.asterisk.org/c/asterisk/+/14520/1/res/res_http_websocket.c@287">Patch Set #1, Line 287:</a> <code style="font-family:monospace,monospace">static void websocket_mask_payload(struct ast_websocket *session, char *frame, char *payload, uint64_t payload_size);</code></p><p><blockquote style="border-left: 1px solid #aaa; margin: 10px 0; padding: 0 10px;">I'd just move the function here instead of declaring it here and defining it below.</blockquote></p><p style="white-space: pre-wrap; word-wrap: break-word;">I can do that.</p></li></ul></li></ul><p>To view, visit <a href="https://gerrit.asterisk.org/c/asterisk/+/14520">change 14520</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/+/14520"/><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: Id465030f2b1997b83d408933fdbabe01827469ca </div>
<div style="display:none"> Gerrit-Change-Number: 14520 </div>
<div style="display:none"> Gerrit-PatchSet: 2 </div>
<div style="display:none"> Gerrit-Owner: Moises Silva <moises.silva@gmail.com> </div>
<div style="display:none"> Gerrit-Reviewer: Friendly Automation </div>
<div style="display:none"> Gerrit-CC: George Joseph <gjoseph@digium.com> </div>
<div style="display:none"> Gerrit-CC: Joshua Colp <jcolp@sangoma.com> </div>
<div style="display:none"> Gerrit-CC: Nickolay V. Shmyrev <nshmyrev@alphacephei.com> </div>
<div style="display:none"> Gerrit-Comment-Date: Mon, 15 Jun 2020 20:32:48 +0000 </div>
<div style="display:none"> Gerrit-HasComments: Yes </div>
<div style="display:none"> Gerrit-Has-Labels: No </div>
<div style="display:none"> Comment-In-Reply-To: George Joseph <gjoseph@digium.com> </div>
<div style="display:none"> Gerrit-MessageType: comment </div>