p9 icon indicating copy to clipboard operation
p9 copied to clipboard

p9: drain extra bytes from message that's larger than msize

Open DeedleFake opened this issue 7 years ago • 0 comments

Currently, if ReadMessage() tries to read a message that's longer than msize, it stops and returns an error. If the connected client is actually a valid client, however, but somehow messed up its msize, this means that the server is left in a position that it can't recover from very cleanly.

A possible fix for this would be for the server to drain the remaining bytes from the long message, allowing the next call to ReadMessage() to read a hopefully valid message. The question, however, is should ReadMessage() handle this automatically in this way. I'm leaning heavily towards it doing so, but I'm a bit worried that it could cause other problems.

DeedleFake avatar May 17 '18 15:05 DeedleFake