mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-14 21:42:19 +00:00
LibCore: Prevent infinite recursion in Directory::ensure_directory()
If a relative path was passed in, then repeatedly asking for its parent will never reach `/`. The top-level path in that case is `.`.
This commit is contained in:
parent
3426592ee7
commit
6967d37678
Notes:
sideshowbarker
2024-07-17 11:50:52 +09:00
Author: https://github.com/AtkinsSJ
Commit: 6967d37678
Pull-request: https://github.com/SerenityOS/serenity/pull/13651
Reviewed-by: https://github.com/kleinesfilmroellchen
1 changed files with 1 additions and 1 deletions
|
@ -61,7 +61,7 @@ ErrorOr<Directory> Directory::create(LexicalPath path, CreateDirectories create_
|
|||
|
||||
ErrorOr<void> Directory::ensure_directory(LexicalPath const& path)
|
||||
{
|
||||
if (path.basename() == "/")
|
||||
if (path.basename() == "/" || path.basename() == ".")
|
||||
return {};
|
||||
|
||||
TRY(ensure_directory(path.parent()));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue