Jump to content

RCON encoding bug

Recommended Posts

Hi Devs, 


There seem to be a bug in Squad's (or EU4) implementation of RCON, mainly for the `ListPlayers` command.


For context RCON response contain an header with the size of the body in bytes. Also most response send text in ASCII (or at least single byte fixed length encoding).


But some exotic characters in player names can make the server answer with UTF-16 (2 bytes per char). It's annoying on it's own to detect, but ok-ish.

The problem is that when it happens, the response lenght header doesn't account for multi-byte encoding , so effectively the response body is twice bigger than advertised.


I managed to develop workarounds for this bug, but I figured I might as well report it.


The workaround: https://github.com/koraktor/steam-condenser/issues/287#issuecomment-283901089 (Ark might possibly have the same issue).


Share this post

Link to post
Share on other sites

It's a non-standard implementation of RCON that means that players with UTF-8 characters in their names can be displayed correctly. 


Thanks for posting your workaround, mine I think checks the packet response for null bytes and if greater than a threshold it reads another (packet length - packet header) bytes from the response.


Personally at first I didn't like this on-the-fly approach to packet encoding but as a way to include all those weird characters and foreign language names that people choose it's a small price to pay.




Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now