Skip to content

mingw: avoid a buffer overrun in needs_hiding() #427

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

Closed

Conversation

dscho
Copy link
Member

@dscho dscho commented Oct 25, 2019

On Unix, files are hidden from the output of ls by default when their names start with a .. On Windows, there is an explicit flag that you need to set.

It is quite uncommon, though, to hide all of the "dot files" on Windows, which is why Git hides only .git by default, and it has a setting to override this default (core.hideDotFiles).

The code to determine whether that flag needs to be set for a given file had a buffer overrun, though, if the path that was passed into the function ended with a directory separator. This patch fixes this.

The original contribution by Alex is over at #414, and I worked with him to evolve it into the current version.

Cc: Alexandr Miloslavskiy [email protected]

When this function is passed a path with a trailing slash, it runs right
over the end of that path.

Let's fix this.

Co-authored-by: Alexandr Miloslavskiy <[email protected]>
Signed-off-by: Johannes Schindelin <[email protected]>
@dscho
Copy link
Member Author

dscho commented Oct 25, 2019

/submit

@dscho
Copy link
Member Author

dscho commented Oct 25, 2019

cc @SyntevoAlex

@gitgitgadget
Copy link

gitgitgadget bot commented Oct 25, 2019

Submitted as [email protected]

@gitgitgadget
Copy link

gitgitgadget bot commented Oct 28, 2019

This branch is now known as js/mingw-needs-hiding-fix.

@gitgitgadget
Copy link

gitgitgadget bot commented Oct 28, 2019

This patch series was integrated into pu via git@a617569.

@gitgitgadget
Copy link

gitgitgadget bot commented Oct 28, 2019

This patch series was integrated into next via git@d412109.

@gitgitgadget
Copy link

gitgitgadget bot commented Oct 29, 2019

This patch series was integrated into pu via git@d617a36.

@gitgitgadget
Copy link

gitgitgadget bot commented Oct 30, 2019

This patch series was integrated into pu via git@f2db52c.

@gitgitgadget
Copy link

gitgitgadget bot commented Oct 30, 2019

This patch series was integrated into next via git@f2db52c.

@gitgitgadget
Copy link

gitgitgadget bot commented Oct 30, 2019

This patch series was integrated into master via git@f2db52c.

@gitgitgadget gitgitgadget bot added the master label Oct 30, 2019
@gitgitgadget gitgitgadget bot closed this Oct 30, 2019
@gitgitgadget
Copy link

gitgitgadget bot commented Oct 30, 2019

Closed via f2db52c.

@dscho dscho deleted the fix-needs-hiding-buffer-overrun branch October 30, 2019 14:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant