aboutsummaryrefslogtreecommitdiffstats
path: root/channels
diff options
context:
space:
mode:
authormmichelson <mmichelson@f38db490-d61c-443f-a65b-d21fe96a405b>2009-09-15 15:42:03 +0000
committermmichelson <mmichelson@f38db490-d61c-443f-a65b-d21fe96a405b>2009-09-15 15:42:03 +0000
commit60a07600f7e54459c9ef96e748acea25c9055be6 (patch)
treede4fee0e6cc64baffd06a2a7c3ba7d3b697b151e /channels
parent8587ffaee36b3a4d55928ad48cc464482ec15237 (diff)
Merged revisions 218566 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk ........ r218566 | mmichelson | 2009-09-15 10:40:14 -0500 (Tue, 15 Sep 2009) | 4 lines Use a better method of ensuring null-termination of the buffer while reading the SDP when using TCP. ........ git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.6.0@218573 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'channels')
-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 ae63f7c3d..0b562693b 100644
--- a/channels/chan_sip.c
+++ b/channels/chan_sip.c
@@ -2275,12 +2275,13 @@ static void *_sip_tcp_helper_thread(struct sip_pvt *pvt, struct ast_tcptls_sessi
parse_copy(&reqcpy, &req);
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;