Re: [PATCH] builtin/repack.c: prune unreachable objects with `--expire-to`

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, Nov 30, 2024 at 07:01:03PM -0500, Taylor Blau wrote:
> diff --git a/builtin/repack.c b/builtin/repack.c
> index d6bb37e84ae..57cab72dcf5 100644
> --- a/builtin/repack.c
> +++ b/builtin/repack.c
> @@ -1553,6 +1553,21 @@ int cmd_repack(int argc,
>  							&existing);
>  		if (show_progress)
>  			opts |= PRUNE_PACKED_VERBOSE;
> +
> +		if (expire_to && *expire_to) {
> +			char *alt = dirname(xstrdup(expire_to));
> +			size_t len = strlen(alt);
> +
> +			if (strip_suffix(alt, "pack", &len) &&
> +			    is_dir_sep(alt[len - 1])) {

Argh. This clearly needs a bounds check to ensure that 'len >= 1'.

I suspect that passing "--expire-to=pack/xyz" would segfault.

Thanks,
Taylor




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux