diff options
author | Idan Horowitz <idan.horowitz@gmail.com> | 2022-01-28 15:38:31 +0200 |
---|---|---|
committer | Idan Horowitz <idan.horowitz@gmail.com> | 2022-01-28 19:05:52 +0200 |
commit | fa7ae7288bb6979c59e37d0ac8a64a39f150bac1 (patch) | |
tree | e1849b5c0c650134753ee29435d16837450a6dd6 /Userland | |
parent | fcdd56633bdbfa6ffa0b75df864705d552223abf (diff) | |
download | serenity-fa7ae7288bb6979c59e37d0ac8a64a39f150bac1.zip |
zip: Ignore symlinks when recursively zipping files
This prevents infinite loops when symlinks point to a parent directory.
Diffstat (limited to 'Userland')
-rw-r--r-- | Userland/Utilities/zip.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/Userland/Utilities/zip.cpp b/Userland/Utilities/zip.cpp index d8d4dbd7fd..dca40dcca9 100644 --- a/Userland/Utilities/zip.cpp +++ b/Userland/Utilities/zip.cpp @@ -101,11 +101,12 @@ ErrorOr<int> serenity_main(Main::Arguments arguments) Core::DirIterator it(path, Core::DirIterator::Flags::SkipParentAndBaseDir); while (it.has_next()) { auto child_path = it.next_full_path(); - if (!Core::File::is_directory(child_path)) { + if (Core::File::is_link(child_path)) + return; + if (!Core::File::is_directory(child_path)) add_file(child_path); - } else { + else handle_directory(child_path, handle_directory); - } } }; |