Revision
16875
Author
sathieu
Date
2010-03-03 01:48:42 -0600 (Wed, 03 Mar 2010)

Log Message

Skinny: avoid stack overflow by lowering button_template_helper size

Modified Paths

Diff

Modified: freeswitch/trunk/src/mod/endpoints/mod_skinny/skinny_protocol.c (16874 => 16875)


--- freeswitch/trunk/src/mod/endpoints/mod_skinny/skinny_protocol.c	2010-03-03 05:24:09 UTC (rev 16874)
+++ freeswitch/trunk/src/mod/endpoints/mod_skinny/skinny_protocol.c	2010-03-03 07:48:42 UTC (rev 16875)
@@ -1445,7 +1445,7 @@
 
 struct button_template_helper {
 	skinny_message_t *message;
-	int count[0xffff+1];
+	int count[SKINNY_BUTTON_UNDEFINED+1];
 };
 
 int skinny_handle_button_template_request_callback(void *pArg, int argc, char **argv, char **columnNames)
@@ -1457,6 +1457,9 @@
 	uint32_t type = atoi(argv[2]);
 	int i;
 	
+	if(type > SKINNY_BUTTON_UNDEFINED) {
+		type = SKINNY_BUTTON_UNDEFINED;
+	}
 	/* fill buttons between previous one and current one */
 	for(i = message->data.button_template.button_count; i+1 < position; i++) {
 		message->data.button_template.btn[i].instance_number = ++helper->count[SKINNY_BUTTON_UNDEFINED];