Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(steam): truncate presence to a valid UTF-8 sequence
With a host name such as "Êîðïîðàöèÿ Ìàéêðîñîôò; Âñå ïðàâà çàùèùåíû", we will try to set a presence name like "test: Êîðïîðàöèÿ Ìàéêðîñîôò; Âñå ïðàâà çàùèùåíû", assuming `steamname.txt` contains "test". Steam, internally, truncates app names to fit in a 64-byte buffer with a null terminator. However, the code which truncates does not ensure the resulting UTF-8 sequence is valid, which might lead to the update being rejected further down the line, which is especially likely with a name consisting solely of multi-byte sequences, like the example name. In this changeset, we circumvent this by truncating the name to 64 bytes ourselves, and subsequently chopping off at the first invalid UTF-8 sequence.
- Loading branch information