[asterisk-commits] mmichelson: branch 1.6.1 r218506 - in /branches/1.6.1: ./ channels/chan_sip.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Sep 15 10:12:39 CDT 2009


Author: mmichelson
Date: Tue Sep 15 10:12:35 2009
New Revision: 218506

URL: http://svn.asterisk.org/svn-view/asterisk?view=rev&rev=218506
Log:
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.
........

Modified:
    branches/1.6.1/   (props changed)
    branches/1.6.1/channels/chan_sip.c

Propchange: branches/1.6.1/
------------------------------------------------------------------------------
Binary property 'trunk-merged' - no diff available.

Modified: branches/1.6.1/channels/chan_sip.c
URL: http://svn.asterisk.org/svn-view/asterisk/branches/1.6.1/channels/chan_sip.c?view=diff&rev=218506&r1=218505&r2=218506
==============================================================================
--- branches/1.6.1/channels/chan_sip.c (original)
+++ branches/1.6.1/channels/chan_sip.c Tue Sep 15 10:12:35 2009
@@ -2449,10 +2449,11 @@
 		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;




More information about the asterisk-commits mailing list