public inbox for linux-erofs@ozlabs.org
 help / color / mirror / Atom feed
From: Gao Xiang <hsiangkao@linux.alibaba.com>
To: Vansh Choudhary <ch@vnsh.in>, linux-erofs@lists.ozlabs.org
Subject: Re: [PATCH] erofs-utils: tar: guard slash-only header names
Date: Tue, 31 Mar 2026 11:34:35 +0800	[thread overview]
Message-ID: <c9224478-e7ad-49fa-ad60-0531f810bfa7@linux.alibaba.com> (raw)
In-Reply-To: <20260330173447.486569-1-ch@vnsh.in>



On 2026/3/31 01:34, Vansh Choudhary wrote:
> Check that the assembled header path is non-empty before trimming
> trailing slashes from it.
> 
> A malformed tar header name made up only of '/' characters could
> otherwise drive the trim loop to read before the start of the buffer.
> 
> Signed-off-by: Vansh Choudhary <ch@vnsh.in>

I don't think it's a valid one.

> ---
>   lib/tar.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/lib/tar.c b/lib/tar.c
> index 4e97522..39e2321 100644
> --- a/lib/tar.c
> +++ b/lib/tar.c
> @@ -866,7 +866,7 @@ out_eot:
>   			path[1] = '\0';
>   		} else {
>   			*_path = '\0';
> -			while (path[j - 1] == '/')
> +			while (j && path[j - 1] == '/')
>   				path[--j] = '\0';
>   		}
>   	}



  reply	other threads:[~2026-03-31  3:34 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-30 17:34 [PATCH] erofs-utils: tar: guard slash-only header names Vansh Choudhary
2026-03-31  3:34 ` Gao Xiang [this message]
2026-03-31  3:58 ` Yifan Zhao

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=c9224478-e7ad-49fa-ad60-0531f810bfa7@linux.alibaba.com \
    --to=hsiangkao@linux.alibaba.com \
    --cc=ch@vnsh.in \
    --cc=linux-erofs@lists.ozlabs.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox