1
0
cuberite-2a/src/Protocol
Tiger Wang 49ef21d650 MultiVersionProtocol: fix two crashes
First one: add missing exception handler in ProcessProtocolIn

Second: remove faulty logic dealing with incomplete packets.

`a_Data = a_Data.substr(m_Buffer.GetUsedSpace() - m_Buffer.GetReadableSpace());`

was incorrect; it attempted to apply a length derived from m_Buffer to an unrelated a_Data. Its purpose was to give cProtocol the data the client sent, minus initial handshake bytes. However, we can use the knowledge that during initial handshake, there is no encryption and every byte can be written unchanged into m_Buffer, to just call cProtocol with a data length of zero. This will cause it to parse from m_Buffer - wherein we have already written everything the client sent - with no a_Data manipulation needed.

Additionally, removed UnsupportedButPingableProtocolException (use of exception as control flow) and encode this state as m_Protocol == nullptr, id est "no protocol for this unsupported version", which is then handled by cMultiVersionProtocol itself.
2021-01-19 09:54:58 +00:00
..
Palettes Prepare for 1.15+ (#4856) 2020-12-21 13:54:04 +00:00
Authenticator.cpp Update submodules (#4727) 2020-05-09 15:51:15 +01:00
Authenticator.h Using Super. 2020-04-16 20:07:48 +00:00
ChunkDataSerializer.cpp Clarify cClientHandle, cPlayer ownership semantics 2021-01-12 12:34:34 +00:00
ChunkDataSerializer.h Clarify cClientHandle, cPlayer ownership semantics 2021-01-12 12:34:34 +00:00
CMakeLists.txt 1.14 connection support 2020-07-26 18:55:16 +01:00
ForgeHandshake.cpp zlib -> libdeflate (#5085) 2021-01-11 16:39:43 +00:00
ForgeHandshake.h zlib -> libdeflate (#5085) 2021-01-11 16:39:43 +00:00
MojangAPI.cpp Update submodules (#4727) 2020-05-09 15:51:15 +01:00
MojangAPI.h Add cUUID class (#3871) 2017-08-25 13:43:18 +01:00
Packetizer.cpp Introduce recipe book functionality (#4493) 2020-07-14 17:56:42 +01:00
Packetizer.h zlib -> libdeflate (#5085) 2021-01-11 16:39:43 +00:00
Protocol_1_8.cpp MultiVersionProtocol: fix two crashes 2021-01-19 09:54:58 +00:00
Protocol_1_8.h zlib -> libdeflate (#5085) 2021-01-11 16:39:43 +00:00
Protocol_1_9.cpp zlib -> libdeflate (#5085) 2021-01-11 16:39:43 +00:00
Protocol_1_9.h zlib -> libdeflate (#5085) 2021-01-11 16:39:43 +00:00
Protocol_1_10.cpp zlib -> libdeflate (#5085) 2021-01-11 16:39:43 +00:00
Protocol_1_10.h Adding new monster types to enum and saving/loading for easier future implementation (#4941) 2020-11-22 23:41:13 +00:00
Protocol_1_11.cpp zlib -> libdeflate (#5085) 2021-01-11 16:39:43 +00:00
Protocol_1_11.h Remove GetProtocolVersion unneeded comments 2020-07-19 23:11:02 +01:00
Protocol_1_12.cpp zlib -> libdeflate (#5085) 2021-01-11 16:39:43 +00:00
Protocol_1_12.h Adding new monster types to enum and saving/loading for easier future implementation (#4941) 2020-11-22 23:41:13 +00:00
Protocol_1_13.cpp zlib -> libdeflate (#5085) 2021-01-11 16:39:43 +00:00
Protocol_1_13.h 1.13+: Send length-prefixed server Brand string 2020-08-28 21:08:06 +01:00
Protocol_1_14.cpp zlib -> libdeflate (#5085) 2021-01-11 16:39:43 +00:00
Protocol_1_14.h Cleanup Protocol classes 2020-09-18 16:41:06 +01:00
Protocol.h zlib -> libdeflate (#5085) 2021-01-11 16:39:43 +00:00
ProtocolRecognizer.cpp MultiVersionProtocol: fix two crashes 2021-01-19 09:54:58 +00:00
ProtocolRecognizer.h MultiVersionProtocol: fix two crashes 2021-01-19 09:54:58 +00:00
RecipeMapper.cpp Introduce recipe book functionality (#4493) 2020-07-14 17:56:42 +01:00
RecipeMapper.h Introduce recipe book functionality (#4493) 2020-07-14 17:56:42 +01:00