Corrupted Packet Data Handling.
Trying to make PRISM a more robust system, and making sure that no garbage data is sent to the plugins, corrupting the data we hold so dear, what do you think the best way of handling invalid packets?

The packet header does contain 2 main items that we should be aware of. The first being the packet size, and the second being the packet type. I think the first step should be making sure that the packet size that is reported should be equal to the packet size we have in the buffer. If these don't match the information should be discarded. The second check would come from both the packet size and the packet type. Where the packet type is fixed to a known length we should check the packet size against the packet type. For instances where the packet is of a variable length, the range of possible values should be checked.

Call for comments on this idea, and if anyone has anything to add that would be great.
That's pretty much all there is to it, check if we've got Size bytes in our buffer, if so check if Size matches the Type and for variable sized packets, check if it's at least the size of the header and a multiple of 4.
Quote from morpha :That's pretty much all there is to it, check if we've got Size bytes in our buffer, if so check if Size matches the Type and for variable sized packets, check if it's at least the size of the header and a multiple of 4.

Ok. Is there something that I missed in networking where the packet get or send must be a modus of 32 bits? And is there any reason physical reason for that?
Multiple of 4 is not correct.

NLP is 4 bytes for header and 6 for each NodeLap. That's no multiple of 4 :O
Its to fill the Internet tubes more efficiently. Can't have empty trucks wasting space on the superhighway.
Quote from GeForz :Multiple of 4 is not correct.

NLP is 4 bytes for header and 6 for each NodeLap. That's no multiple of 4 :O

actually lfs will fill it up to make a multiple of 4 if needed.

struct IS_NLP // Node and Lap Packet - variable size
{
byte Size; // 4 + NumP * 6 (PLUS 2 if needed to make it a multiple of 4)

Quote from Victor :actually lfs will fill it up to make a multiple of 4 if needed.

struct IS_NLP // Node and Lap Packet - variable size
{
byte Size; // 4 + NumP * 6 (PLUS 2 if needed to make it a multiple of 4)


Because it's more memory efficient in C that way ... I still can't find any resources on why this is true. So if Scawen cares to shed some light that would be awesome.
Quote from Victor :actually lfs will fill it up to make a multiple of 4 if needed.

struct IS_NLP // Node and Lap Packet - variable size
{
byte Size; // 4 + NumP * 6 (PLUS 2 if needed to make it a multiple of 4)


Oups
Quote from Dygear :Because it's more memory efficient in C that way ... I still can't find any resources on why this is true. So if Scawen cares to shed some light that would be awesome.

This and that might help you understand

€: Beaten by Vic

FGED GREDG RDFGDR GSFDG