aboutsummaryrefslogtreecommitdiffstats
path: root/channels
diff options
context:
space:
mode:
authormmichelson <mmichelson@f38db490-d61c-443f-a65b-d21fe96a405b>2009-09-15 15:11:50 +0000
committermmichelson <mmichelson@f38db490-d61c-443f-a65b-d21fe96a405b>2009-09-15 15:11:50 +0000
commit8587ffaee36b3a4d55928ad48cc464482ec15237 (patch)
tree78cae288559c63d053451e7594d4a3bf7ee41dca /channels
parentc88ce9967bee28b0fa22a57ea8e69bb19a369d28 (diff)
Merged revisions 218499,218504 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk ........ r218499 | mmichelson | 2009-09-15 09:59:50 -0500 (Tue, 15 Sep 2009) | 3 lines Fix off-by-one error when reading SDP sent over TCP. ........ r218504 | mmichelson | 2009-09-15 10:05:53 -0500 (Tue, 15 Sep 2009) | 3 lines Ensure that SDP read from TCP socket is null-terminated. ........ git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.6.0@218505 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'channels')
-rw-r--r--channels/chan_sip.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/channels/chan_sip.c b/channels/chan_sip.c
index b08a1cdb6..ae63f7c3d 100644
--- a/channels/chan_sip.c
+++ b/channels/chan_sip.c
@@ -2276,10 +2276,11 @@ static void *_sip_tcp_helper_thread(struct sip_pvt *pvt, struct ast_tcptls_sessi
if (sscanf(get_header(&reqcpy, "Content-Length"), "%30d", &cl)) {
while (cl > 0) {
ast_mutex_lock(&tcptls_session->lock);
- if (!fread(buf, (cl < sizeof(buf)) ? cl : sizeof(buf), 1, tcptls_session->f)) {
+ if (!fread(buf, MIN(sizeof(buf) - 1, cl), 1, tcptls_session->f)) {
ast_mutex_unlock(&tcptls_session->lock);
goto cleanup;
}
+ buf[sizeof(buf)-1] = '\0';
ast_mutex_unlock(&tcptls_session->lock);
if (me->stop)
goto cleanup;