Shared/Networking: Fix buffer overflow in Socket handling

Fix a buffer overflow caused by Boost trying to store too much data in a buffer too small.

(cherry picked from commit cdf6c884624be33b5782bcca0e206e5c291a517b)