Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix issues in code #79

Merged
merged 4 commits into from
Jul 29, 2024
Merged

Fix issues in code #79

merged 4 commits into from
Jul 29, 2024

Conversation

Jan200101
Copy link
Contributor

  • strreplace makes use of realloc which does not guarantee to reuse the same location in memory, thus the pointer needs to be reassaigned
  • fix the faulty strstr_i implementation, it ran ahead of p1 and read 1 byte out of bounds
  • correct strstr_i signature, previously it discarded const on return
  • free allocated memory (where I could easily find it) after use
  • prevent buffer overrun when fetching non-steam apps by checking if we are in the buffer size

realloc cannot guaranteed to use same location which is why the pointer needs to be reassigned
the original implementation tried driving p1 ahead resulting in an invalid read once we reach the null termination
fixed by checking p1 and incrementing it later
fixed bad function signature, we cannot return const char* as char*
@doZennn doZennn requested a review from mpaterakis July 28, 2024 20:40
@doZennn doZennn merged commit 11495d3 into SteamGridDB:main Jul 29, 2024
2 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants