Fix segfault when sending a very large net chat message.
This crash occured on the receiver machine, making it effectively a remote crash attack.
Reported by: Riddler66
Based on a patch by: elexis
Fixes #5726
Differential Revision: https://code.wildfiregames.com/D2629