[Spread-cvs] cvs commit: spread/daemon Readme.txt sp.c
jonathan at spread.org
jonathan at spread.org
Mon Feb 9 14:35:12 EST 2004
jonathan 04/02/09 14:35:12
Modified: daemon Readme.txt sp.c
Log:
Fix bug when messages are received by library and the client does not provide
sufficient buffer or groups space. The mess_type field that is returned then
will not be endian-corrected 'correctly'.
Revision Changes Path
1.47 +3 -0 spread/daemon/Readme.txt
Index: Readme.txt
===================================================================
RCS file: /storage/cvsroot/spread/daemon/Readme.txt,v
retrieving revision 1.46
retrieving revision 1.47
diff -u -r1.46 -r1.47
--- Readme.txt 8 Feb 2004 15:06:29 -0000 1.46
+++ Readme.txt 9 Feb 2004 19:35:11 -0000 1.47
@@ -74,6 +74,9 @@
network packet overhead.
*) Make mailbox and service in sp.h a typedef instead of a #define. Suggested
and patched by Steven Dake.
+*) Fix small endianness error in sp.c where the mess_type field may not be
+ correctly converted for different endian platforms when the SP_*_recv calls
+ return a BUFFER_TOO_SHORT or GROUPS_TOO_SHORT error.
June 20, 2003 Ver 3.17.1
----------------------------
1.10 +9 -2 spread/daemon/sp.c
Index: sp.c
===================================================================
RCS file: /storage/cvsroot/spread/daemon/sp.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- sp.c 2 Feb 2004 21:36:46 -0000 1.9
+++ sp.c 9 Feb 2004 19:35:11 -0000 1.10
@@ -1107,6 +1107,7 @@
message_header mess_head;
message_header *head_ptr;
char *buf_ptr;
+ int16 temp_mess_type;
int len, remain, ret;
int max_mess_len;
int short_buffer;
@@ -1231,8 +1232,14 @@
Sessions[ses].recv_message_saved = 1;
Mutex_unlock( &Struct_mutex );
}
- if ( Is_regular_mess( head_ptr->type ) )
- *mess_type = ( head_ptr->hint >> 8 ) & 0x0000ffff;
+ if ( Is_regular_mess( head_ptr->type ) || Is_reject_mess( head_ptr->type ) )
+ {
+ temp_mess_type = head_ptr->hint;
+ if ( !Same_endian( head_ptr->hint ) ) {
+ temp_mess_type = Flip_int32( temp_mess_type );
+ }
+ *mess_type = ( temp_mess_type >> 8 ) & 0x0000ffff;
+ }
else
*mess_type = 0;
*service_type = Clear_endian( head_ptr->type );
More information about the Spread-cvs
mailing list