Implemented proper validation of variable-length packets.

Also changed output buffer in pcAttackNpcs() from dynamically to
statically allocated. This in itself is temporary as I have a better
idea as to how we can allocate buffers with a bit less boilerplate.
This commit is contained in:
2020-08-28 16:09:26 +02:00
parent 64accecc30
commit 67d899efe6
3 changed files with 55 additions and 14 deletions

View File

@@ -170,7 +170,7 @@ void CNSocket::step() {
// we got out packet size!!!!
readSize = *((int32_t*)readBuffer);
// sanity check
if (readSize > MAX_PACKETSIZE) {
if (readSize > CN_PACKET_BUFFER_SIZE) {
kill();
return;
}