[Spread-cvs] commit: r443 - trunk/daemon
jonathan at spread.org
jonathan at spread.org
Fri Jan 6 20:13:14 EST 2012
Author: jonathan
Date: 2012-01-06 20:13:14 -0500 (Fri, 06 Jan 2012)
New Revision: 443
Modified:
trunk/daemon/Changelog
trunk/daemon/message.c
Log:
Add sanity check to geneate clean fatal error if a message larger then scatter is generated. This should never happen unless there is a bug since the library won't let such a message be sent
Modified: trunk/daemon/Changelog
===================================================================
--- trunk/daemon/Changelog 2012-01-07 01:10:41 UTC (rev 442)
+++ trunk/daemon/Changelog 2012-01-07 01:13:14 UTC (rev 443)
@@ -1,3 +1,10 @@
+Fri Jan 6 20:12:34 2012 Jonathan Stanton <jonathan at spreadconcepts.com>
+
+ * message.c (Message_Buffer_to_Message_Fragments): Add sanity check
+ that will log error and shut down if a message larger then a scatter
+ is generated. Should be impossible because client library should
+ prevent such a message.
+
Fri Jan 6 19:58:12 2012 Jonathan Stanton <jonathan at spreadconcepts.com>
* protocol.c (Handle_hurry): Fix token hurry bug where one daemon
Modified: trunk/daemon/message.c
===================================================================
--- trunk/daemon/message.c 2012-01-07 01:10:41 UTC (rev 442)
+++ trunk/daemon/message.c 2012-01-07 01:13:14 UTC (rev 443)
@@ -326,6 +326,12 @@
scat = Message_get_data_scatter(msg);
head_size = Message_get_data_header_size();
scat->num_elements = (num_bytes + head_size -1)/sizeof( packet_body ) + 1;
+
+ if (scat->num_elements > MAX_SCATTER_ELEMENTS) {
+ /* Message is too large */
+ Alarmp(SPLOG_FATAL, PROTOCOL, "Message_Buffer_to_Message_Fragments: Number of scatter elements required for message (%d) is larger then the compiled in MAX_SCATTER_ELEMENTS (%d)\n", scat->num_elements, MAX_SCATTER_ELEMENTS);
+ return;
+ }
copied_bytes = 0;
for( i=0; i < scat->num_elements ; i++ )
{
More information about the Spread-cvs
mailing list