Update of /cvsroot/playerstage/code/player/client_libs/libplayerc
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18431

Modified Files:
        client.c 
Log Message:
added code to handle improperly unpacked message

Index: client.c
===================================================================
RCS file: /cvsroot/playerstage/code/player/client_libs/libplayerc/client.c,v
retrieving revision 1.91
retrieving revision 1.92
diff -C2 -d -r1.91 -r1.92
*** client.c    7 Dec 2007 01:50:14 -0000       1.91
--- client.c    15 Jan 2008 23:50:52 -0000      1.92
***************
*** 1032,1037 ****
    if (header->size > PLAYERXDR_MAX_MESSAGE_SIZE - PLAYERXDR_MSGHDR_SIZE)
    {
!     PLAYERC_ERR1("packet is too large, %d bytes", header->size);
!     return -1;
    }
  
--- 1032,1036 ----
    if (header->size > PLAYERXDR_MAX_MESSAGE_SIZE - PLAYERXDR_MSGHDR_SIZE)
    {
!     PLAYERC_WARN1("packet is too large, %d bytes", header->size);
    }
  
***************
*** 1070,1074 ****
    // Locate the appropriate unpacking function for the message body
    if(!(packfunc = playerxdr_get_packfunc(header->addr.interf, header->type,
!                                      header->subtype)))
    {
      // TODO: Allow the user to register a callback to handle unsupported
--- 1069,1073 ----
    // Locate the appropriate unpacking function for the message body
    if(!(packfunc = playerxdr_get_packfunc(header->addr.interf, header->type,
!                                          header->subtype)))
    {
      // TODO: Allow the user to register a callback to handle unsupported
***************
*** 1076,1079 ****
--- 1075,1085 ----
      PLAYERC_ERR4("skipping message from %s:%u with unsupported type %s:%u",
                   interf_to_str(header->addr.interf), header->addr.index, 
msgtype_to_str(header->type), header->subtype);
+ 
+     // Slide over the body
+     memmove(client->read_xdrdata,
+             client->read_xdrdata + header->size,
+             client->read_xdrdata_len - header->size);
+     client->read_xdrdata_len -= header->size;
+ 
      return(-1);
    }


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Playerstage-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/playerstage-commit

Reply via email to