Fix extracting over symlinks with --dereference

Extraction over symlink to a directory was broken in 75b03fdff4.
See https://savannah.gnu.org/bugs/index.php?68368

* src/tar.c (decode_options): Don't enable RESOLVE_BENEATH mode
if --dereference is given.
* tests/extrac33.at: New test.
* tests/Makefile.am: Add new test.
* tests/testsuite.at: Likewise.
* tests/extrac13.at: Add a keyword.
* tests/extrac31.at: Remove --absolute-names keyword: that option
is never used in the testcase. Add CVE-2025-45582 keyword instead.
This commit is contained in:
Sergey Poznyakoff
2026-06-11 16:35:20 +03:00
parent cb1973cc0e
commit 145a671e8a
6 changed files with 58 additions and 4 deletions
+1 -1
View File
@@ -2712,7 +2712,7 @@ decode_options (int argc, char **argv)
#endif
open_searchdir_how.flags = (search_flags | nofollow_flag
| O_BINARY | O_CLOEXEC | O_DIRECTORY);
if (!absolute_names_option
if (!absolute_names_option && !dereference_option
&& (subcommand_option == EXTRACT_SUBCOMMAND
|| subcommand_option == DIFF_SUBCOMMAND))
open_searchdir_how.resolve = RESOLVE_BENEATH;