Skip to content

Do not abort() on an oversized position packet - #258

Draft
IrPgFKS0 wants to merge 1 commit into
BeamMP:masterfrom
IrPgFKS0:fix/no-abort-on-oversized-position-packet
Draft

Do not abort() on an oversized position packet#258
IrPgFKS0 wants to merge 1 commit into
BeamMP:masterfrom
IrPgFKS0:fix/no-abort-on-oversized-position-packet

Conversation

@IrPgFKS0

@IrPgFKS0 IrPgFKS0 commented Jul 5, 2026

Copy link
Copy Markdown

Problem

ServerSend() in src/Network/GlobalHandler.cpp calls abort() — a process-killing crash — when a packet over 500 bytes contains "Zp". Two problems:

  1. Ordinary runtime data can trigger it: an oversized position packet should be dropped, not take down the whole launcher (and with it the player's session).
  2. Data.find("Zp") != npos matches those two bytes anywhere in the payload — so an unrelated packet (chat message, event payload, mod data) that merely contains the substring Zp and is over 500 bytes kills the launcher too.

Fix

Check the actual packet code (Data[0] == 'Z' && Data[1] == 'p' — safe, the size check precedes it) and drop the oversized packet with a debug log instead of aborting.

How this was found

Hit in practice on a LAN fork of BeamMP (an oversized position payload aborted the launcher mid-session); the graceful-drop version has been running in that fork for weeks of sessions.

Transparency

This fix comes from an AI-assisted fork: the bug was found and the patch written with the help of an AI coding tool (Claude), then tested by a human in real multiplayer sessions. Given this project's policy on AI-generated code, it's submitted as a draft for the maintainers to decide — happy to close it if that's not wanted, or for a maintainer to re-implement it independently.

🤖 Generated with Claude Code

ServerSend() called abort() -- a process-killing crash -- when a packet
over 500 bytes contained "Zp". Two problems: ordinary runtime data can
trigger it (an oversized position packet should be dropped, not crash
the launcher), and find() matched "Zp" anywhere in the payload, so an
unrelated packet that merely contained those two bytes could kill the
launcher as well. Check the actual packet code prefix and drop the
packet gracefully instead.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@Unshown

Unshown commented Aug 24, 2026

Copy link
Copy Markdown

This sounds like an active issue happening on some servers. Can this be looked into? I dont see any big issues with this change. Disconnect issues have been a plague since forever!

@WiserTixx

Copy link
Copy Markdown
Collaborator

Yes, this will be addressed in an upcoming patch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants