]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
Skinny: Milestone 0 : no-op module (listeners and base skinny parsing)
authorMathieu Parent <math.parent@gmail.com>
Wed, 24 Feb 2010 11:57:53 +0000 (11:57 +0000)
committerMathieu Parent <math.parent@gmail.com>
Wed, 24 Feb 2010 11:57:53 +0000 (11:57 +0000)
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

index 8712ce68b7e11aea3bce7b6808a1224f247e47d9..9515b6cc0bdacdb6cb78f24480a8f9b9bdbe0eb3 100644 (file)
@@ -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 */