libgamestream: fix uniqueid.dat read check - #933
Merged
Conversation
fread(unique_id, UNIQUEID_CHARS, 1, fd) returns the number of items read (1 on success), not bytes, so the != UNIQUEID_CHARS comparison is always true. Any existing uniqueid.dat is silently ignored and rewritten with the default 0123456789ABCDEF on every run, making a custom per-device uniqueid impossible.
Member
|
Merged, thanks! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
fread(unique_id, UNIQUEID_CHARS, 1, fd)returns the number of items read (1 on success), not bytes, so the!= UNIQUEID_CHARScomparison is always true. The result is that an existing uniqueid.dat is silently ignored and rewritten with the default0123456789ABCDEFon every run, so a custom per-device uniqueid is impossible.This bit me when pairing a second moonlight-embedded client against a host that keys pairing state by uniqueid (moonshine). Once the first device pairs with the shared default id, the second client is told it's already paired and
gs_pairbails before ever sending getservercert.Fix is to compare against the item count. Tested on 2.7.0 (same code as master): with this change a custom uniqueid.dat survives restarts and the second client pairs fine.