Skip to content

[rcore] Fix GetDirectoryPath() and GetPrevDirectoryPath() overflo… - #6331

Open
akashdeshmukh-git wants to merge 1 commit into
raysan5:masterfrom
akashdeshmukh-git:fix-directory-path-overflow
Open

akashdeshmukh-git wants to merge 1 commit into
raysan5:masterfrom
akashdeshmukh-git:fix-directory-path-overflow

Conversation

@akashdeshmukh-git

Copy link
Copy Markdown
Contributor

…wing their buffer on long paths

Both functions copied the directory part of the path into a static buffer of MAX_FILEPATH_LENGTH bytes without checking its length, so a longer path (more than 260 characters on Windows, where long paths are allowed since Windows 10) wrote past the buffer. Such paths now return an empty string with a warning, as other path functions skip paths that are too long.

GetDirectoryPath() also read past the end of an empty string when checking for a drive letter.

…wing their buffer on long paths

Both functions copied the directory part of the path into a static buffer
of MAX_FILEPATH_LENGTH bytes without checking its length, so a longer path
(more than 260 characters on Windows, where long paths are allowed since
Windows 10) wrote past the buffer.  Such paths now return an empty string
with a warning, as other path functions skip paths that are too long.

GetDirectoryPath() also read past the end of an empty string when checking
for a drive letter.

This branch has not been deployed

No deployments
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.

1 participant