<h1>Project "FreeSWITCH Source" received a push.</h1>
<h2>branch: master updated</h2>
<pre>
via: e8a1055854bb4cc7037f3be434e261280714dfdf (commit)
from: 3116334d277b0f69305434388bd56f32ae1cb2e6 (commit)
</pre>= COMMIT LOG ===========================================================
<div class="highlight"><pre>committer: Anthony Minessale
comments:
ESL-56 null terminate buffer after reading from the socket to prevent cross-over to old data that confuses the parser and throws off framing. (regression from 2081bf97b9836f5299c22edbb1ead077842ea2bc)
<span style="color: #000080; font-weight: bold">diff --git a/libs/esl/src/esl.c b/libs/esl/src/esl.c</span>
<span style="color: #000080; font-weight: bold">index 078c5de..cd103ec 100644</span>
<span style="color: #A00000">--- a/libs/esl/src/esl.c</span>
<span style="color: #00A000">+++ b/libs/esl/src/esl.c</span>
<span style="color: #800080; font-weight: bold">@@ -949,15 +949,18 @@ ESL_DECLARE(esl_status_t) esl_recv_event(esl_handle_t *handle, int check_q, esl_</span>
        while(!revent && handle->connected) {
                esl_size_t len1;
                
<span style="color: #A00000">-                if ((len1 = esl_buffer_read_packet(handle->packet_buf, handle->socket_buf, sizeof(handle->socket_buf)))) {</span>
<span style="color: #00A000">+                if ((len1 = esl_buffer_read_packet(handle->packet_buf, handle->socket_buf, sizeof(handle->socket_buf) - 1))) {</span>
                        char *data = (char *) handle->socket_buf;
                        char *p, *e;
<span style="color: #00A000">+</span>
<span style="color: #00A000">+                        *(data + len1) = '\0';</span>
                        
                        esl_event_create(&revent, ESL_EVENT_CLONE);
                        revent->event_id = ESL_EVENT_SOCKET_DATA;
                        esl_event_add_header_string(revent, ESL_STACK_BOTTOM, "Event-Name", "SOCKET_DATA");
                        
                        hname = p = data;
<span style="color: #00A000">+</span>
                        while(p) {
                                hname = p;
                                p = NULL;
<span style="color: #800080; font-weight: bold">@@ -984,7 +987,8 @@ ESL_DECLARE(esl_status_t) esl_recv_event(esl_handle_t *handle, int check_q, esl_</span>
                        break;
                }
<span style="color: #A00000">-                rrval = handle_recv(handle, handle->socket_buf, sizeof(handle->socket_buf));</span>
<span style="color: #00A000">+                rrval = handle_recv(handle, handle->socket_buf, sizeof(handle->socket_buf) - 1);</span>
<span style="color: #00A000">+                *((char *)handle->socket_buf + rrval) = '\0';</span>
                
                if (rrval == 0) {
                        if (++zc >= 100) {
<span style="color: #800080; font-weight: bold">@@ -1020,7 +1024,8 @@ ESL_DECLARE(esl_status_t) esl_recv_event(esl_handle_t *handle, int check_q, esl_</span>
                        if (s >= len) {
                                sofar = esl_buffer_read(handle->packet_buf, body, len);
                        } else {
<span style="color: #A00000">-                                r = handle_recv(handle, handle->socket_buf, sizeof(handle->socket_buf));</span>
<span style="color: #00A000">+                                r = handle_recv(handle, handle->socket_buf, sizeof(handle->socket_buf) - 1);</span>
<span style="color: #00A000">+                                *((char *)handle->socket_buf + r) = '\0';</span>
                                if (r < 0) {
                                        strerror_r(handle->errnum, handle->err, sizeof(handle->err));
</pre></div>
========================================================================<pre>
Summary of changes:
libs/esl/src/esl.c | 11 ++++++++---
1 files changed, 8 insertions(+), 3 deletions(-)
</pre>
<p>this email was generated because of /git/your-repo.git/hooks/post-receive by the file /git-core/contrib/hooks/post-receive-email<br />
For more info, see <a href="http://blog.chomperstomp.com/?p=630">http://blog.chomperstomp.com/?p=630</a>
-- <br />
FreeSWITCH Source</p>