aboutsummaryrefslogtreecommitdiffstats
path: root/channels/chan_sip.c
diff options
context:
space:
mode:
Diffstat (limited to 'channels/chan_sip.c')
-rw-r--r--channels/chan_sip.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/channels/chan_sip.c b/channels/chan_sip.c
index 5a07d782e..f87fe8af8 100644
--- a/channels/chan_sip.c
+++ b/channels/chan_sip.c
@@ -2448,12 +2448,13 @@ static void *_sip_tcp_helper_thread(struct sip_pvt *pvt, struct ast_tcptls_sessi
parse_request(&reqcpy);
if (sscanf(get_header(&reqcpy, "Content-Length"), "%30d", &cl)) {
while (cl > 0) {
+ size_t bytes_read;
ast_mutex_lock(&tcptls_session->lock);
- if (!fread(buf, MIN(sizeof(buf) - 1, cl), 1, tcptls_session->f)) {
+ if (!(bytes_read = fread(buf, MIN(sizeof(buf) - 1, cl), 1, tcptls_session->f))) {
ast_mutex_unlock(&tcptls_session->lock);
goto cleanup;
}
- buf[sizeof(buf)-1] = '\0';
+ buf[bytes_read] = '\0';
ast_mutex_unlock(&tcptls_session->lock);
if (me->stop)
goto cleanup;