Re: [PATCH] expand: Fix off-by-one bug in expmeta

[email protected] Mon, 29 Sep 2025 13:40:27 -0500
Newsgroups org.kernel.vger.dash
Message-ID <[email protected]>
I can confirm that that patch works for me. Thanks!

On 9/27/25 10:45 PM, Herbert Xu <[email protected]> wrote:
> On Fri, Sep 26, 2025 at 04:15:15PM +0000, Reilly Brogan wrote:
> >
> > ../configure: 9961: .: cannot open ../gcc/cp/config-lang.in���M�U: No such
> > file
> > ```
> 
> This was caused by the failure to include the terminating NUL
> character when expanding path names.
> 
> ---8<---
> Ensure the terminating NUL character is included when expanding
> path names.
> 
> Reported-by: Reilly Brogan <[email protected]>
> Fixes: a9012f4078be ("expand: Process multi-byte characters in expmeta")
> Signed-off-by: Herbert Xu <[email protected]>
> 
> diff --git a/src/expand.c b/src/expand.c
> index 1fab394..912384d 100644
> --- a/src/expand.c
> +++ b/src/expand.c
> @@ -1686,7 +1686,7 @@ static char *expmeta(char *name, unsigned name_len, size_t expdir_len)
>   			goto out_opendir;
>   		enddir = expmeta_rmescapes(enddir, name);
>   		if (lstat64(cp, &statb) >= 0)
> -			cp = addfnamealt(enddir, expdir_len);
> +			cp = addfnamealt(enddir + 1, expdir_len);
>   		goto out_opendir;
>   	}
>   	start = memrchr(name, '/', p - name);
>