From 0117bdd936cd8e04f24c0e089d3334cd8ec684e1 Mon Sep 17 00:00:00 2001 From: Mathieu Parent Date: Wed, 24 Feb 2010 11:57:53 +0000 Subject: [PATCH] Skinny: Milestone 0 : no-op module (listeners and base skinny parsing) Check for huge message git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@16748 d0543943-73ff-0310-b7d9-9358b9ac24b2 --- src/mod/endpoints/mod_skinny/mod_skinny.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/mod/endpoints/mod_skinny/mod_skinny.c b/src/mod/endpoints/mod_skinny/mod_skinny.c index 8712ce68b7..9515b6cc0b 100644 --- a/src/mod/endpoints/mod_skinny/mod_skinny.c +++ b/src/mod/endpoints/mod_skinny/mod_skinny.c @@ -621,9 +621,15 @@ static switch_status_t skinny_read_packet(listener_t *listener, skinny_message_t 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 */