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

lfs_dir_open() does not handle "." and ".." at end of a path #51

Closed
husigeza opened this issue Apr 22, 2018 · 3 comments
Closed

lfs_dir_open() does not handle "." and ".." at end of a path #51

husigeza opened this issue Apr 22, 2018 · 3 comments

Comments

@husigeza
Copy link

Hello,

I noticed that lfs_dir_open() does not handle paths where the last "location" is given as "." or "..".
E.g.: "/test/mydirectory/.." or "/test/mydirectory/." will open directory "/" (root), but "/test/mydirectory/../mydirectory" opens "mydirectory" correctly.

Could you check this please ?

Thanks,
Geza

@geky
Copy link
Member

geky commented Apr 22, 2018

Good find! Thanks for raising an issue.

I'm not sure I can change that behaviour easily, currently littlefs finds the last name and relies on the null terminator at the end of the path.

I might be able to use a length with the path name, but it'll need several changes to implement.

@geky
Copy link
Member

geky commented Apr 22, 2018

Nevermind, it was still fixable in the current implementation. Although there was a bit of restructuring to make the check work out.

Does this fix work for you?
https://github.com/geky/littlefs/compare/fix-trailing-dots

@husigeza
Copy link
Author

Hello,

Yes it works, thanks!

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

No branches or pull requests

2 participants