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

[rcore] Use snprintf to prevent buffer overflow in path construction #4833

Merged
merged 1 commit into from
Mar 12, 2025

Conversation

MykBamberg
Copy link
Contributor

In some cases, specific user configurations may allow for file/directory paths that exceed the set path limit. In such cases the current implementation of ScanDirectoryFiles would cause a buffer overflow.

This change makes sure that the path string does not exceed the buffer size, failing gracefully with the following warning.

WARNING: FILEIO: Path longer than 4096 characters ([very long path]...)
WARNING: FILEIO: Read files count do not match capacity allocated

@raysan5 raysan5 merged commit 654d5c8 into raysan5:master Mar 12, 2025
@raysan5
Copy link
Owner

raysan5 commented Mar 12, 2025

@MykBamberg Thanks for the improvement. Note that I'm reviewing the implementation, I prefer to avoid the sizeof() approach for sizes.

raysan5 added a commit that referenced this pull request Mar 12, 2025
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.

None yet

2 participants