Re: [PATCH] tar: only strip unsafe components from hardlinks, not symlinks

Denys Vlasenko via busybox <[email protected]>
Newsgroups gmane.linux.busybox
Message-ID <CAK1hOcN=9=R8_rQ2BduPv+8V2Rkm7JWONUVXRo1ENiXLWdSJ7Q@mail.gmail.com>
Applied, thank you

On Mon, Feb 16, 2026 at 10:50 AM Radoslav Kolev <[email protected]> wrote:
>
> commit 3fb6b31c7 introduced a check for unsafe components in
> tar archive hardlinks, but it was being applied to symlinks too
> which broke "Symlinks and hardlinks coexist" tar test.
>
> Signed-off-by: Radoslav Kolev <[email protected]>
> ---
>  archival/libarchive/get_header_tar.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/archival/libarchive/get_header_tar.c b/archival/libarchive/get_header_tar.c
> index 1c40ecedb..606d8067f 100644
> --- a/archival/libarchive/get_header_tar.c
> +++ b/archival/libarchive/get_header_tar.c
> @@ -455,7 +455,7 @@ char FAST_FUNC get_header_tar(archive_handle_t *archive_handle)
>
>         /* Everything up to and including last ".." component is stripped */
>         strip_unsafe_prefix(file_header->name);
> -       if (file_header->link_target) {
> +       if (file_header->link_target && !S_ISLNK(file_header->mode)) {
>                 /* GNU tar 1.34 examples:
>                  * tar: Removing leading '/' from hard link targets
>                  * tar: Removing leading '../' from hard link targets
> --
> 2.52.0
>
_______________________________________________
busybox mailing list
[email protected]
https://lists.busybox.net/mailman/listinfo/busybox
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.