[Freeswitch-svn] [commit] r7221 - freeswitch/trunk/src

Freeswitch SVN mikej at freeswitch.org
Mon Jan 14 16:27:40 EST 2008


Author: mikej
Date: Mon Jan 14 16:27:40 2008
New Revision: 7221

Modified:
   freeswitch/trunk/src/switch_core_io.c
   freeswitch/trunk/src/switch_rtp.c

Log:
don't send very large dtmf strings or block on very large dtmf strings.

Modified: freeswitch/trunk/src/switch_core_io.c
==============================================================================
--- freeswitch/trunk/src/switch_core_io.c	(original)
+++ freeswitch/trunk/src/switch_core_io.c	Mon Jan 14 16:27:40 2008
@@ -973,6 +973,11 @@
 		return SWITCH_STATUS_FALSE;
 	}
 
+	if (strlen(dtmf_string) > 99) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Attempt to send very large dtmf string ignored!\n");
+		return SWITCH_STATUS_FALSE;
+	}
+
 	string = switch_core_session_strdup(session, dtmf_string);
 	argc = switch_separate_string(string, '+', argv, (sizeof(argv) / sizeof(argv[0])));
 	

Modified: freeswitch/trunk/src/switch_rtp.c
==============================================================================
--- freeswitch/trunk/src/switch_rtp.c	(original)
+++ freeswitch/trunk/src/switch_rtp.c	Mon Jan 14 16:27:40 2008
@@ -1202,7 +1202,10 @@
 
 	if ((rdigit = malloc(sizeof(*rdigit))) != 0) {
 		*rdigit = *dtmf;
-		switch_queue_push(rtp_session->dtmf_data.dtmf_queue, rdigit);
+		if ((switch_queue_trypush(rtp_session->dtmf_data.dtmf_queue, rdigit)) != SWITCH_STATUS_SUCCESS) {
+			free(rdigit);
+			return SWITCH_STATUS_FALSE;
+		}
 	} else {
 		abort();
 	}
@@ -1222,7 +1225,10 @@
 
 	if ((rdigit = malloc(sizeof(*rdigit))) != 0) {
 		*rdigit = *dtmf;
-		switch_queue_push(rtp_session->dtmf_data.dtmf_inqueue, rdigit);
+		if ((switch_queue_trypush(rtp_session->dtmf_data.dtmf_inqueue, rdigit)) != SWITCH_STATUS_SUCCESS) {
+			free(rdigit);
+			return SWITCH_STATUS_FALSE;
+		}
 	} else {
 		abort();
 	}



More information about the Freeswitch-svn mailing list