[asterisk-commits] mmichelson: trunk r218499 - /trunk/channels/chan_sip.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Sep 15 09:59:54 CDT 2009


Author: mmichelson
Date: Tue Sep 15 09:59:50 2009
New Revision: 218499

URL: http://svn.asterisk.org/svn-view/asterisk?view=rev&rev=218499
Log:
Fix off-by-one error when reading SDP sent over TCP.


Modified:
    trunk/channels/chan_sip.c

Modified: trunk/channels/chan_sip.c
URL: http://svn.asterisk.org/svn-view/asterisk/trunk/channels/chan_sip.c?view=diff&rev=218499&r1=218498&r2=218499
==============================================================================
--- trunk/channels/chan_sip.c (original)
+++ trunk/channels/chan_sip.c Tue Sep 15 09:59:50 2009
@@ -2963,7 +2963,7 @@
 		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;
 				}




More information about the asterisk-commits mailing list