Revision
16748
Author
sathieu
Date
2010-02-24 05:57:53 -0600 (Wed, 24 Feb 2010)

Log Message

Skinny: Milestone 0 : no-op module (listeners and base skinny parsing)

Check for huge message

Modified Paths

Diff

Modified: freeswitch/trunk/src/mod/endpoints/mod_skinny/mod_skinny.c (16747 => 16748)


--- freeswitch/trunk/src/mod/endpoints/mod_skinny/mod_skinny.c	2010-02-24 11:57:45 UTC (rev 16747)
+++ freeswitch/trunk/src/mod/endpoints/mod_skinny/mod_skinny.c	2010-02-24 11:57:53 UTC (rev 16748)
@@ -621,10 +621,16 @@
 					request->length,request->reserved,request->type);
 				if(request->length < SKINNY_MESSAGE_FIELD_SIZE) {
 					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR,
-						"Skinny client sent invalid data. Length should be greated than 4 but got %d.\n",
+						"Skinny client sent invalid data. Length should be greater than 4 but got %d.\n",
 						request->length);
-					return  SWITCH_STATUS_FALSE;
+					return SWITCH_STATUS_FALSE;
 				}
+				if(request->length + 2*SKINNY_MESSAGE_FIELD_SIZE > SKINNY_MESSAGE_MAXSIZE) {
+					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR,
+						"Skinny client sent too huge data. Got %d which is above threshold %d.\n",
+						request->length, SKINNY_MESSAGE_MAXSIZE - 2*SKINNY_MESSAGE_FIELD_SIZE);
+					return SWITCH_STATUS_FALSE;
+				}
 				if(bytes >= request->length + 2*SKINNY_MESSAGE_FIELD_SIZE) {
 					/* Message body */
 					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO,