[PATCH] expand: Fix off-by-one bug in expmeta
Herbert Xu <[email protected]> Sun, 28 Sep 2025 11:45:18 +0800
| Newsgroups | org.kernel.vger.dash |
|---|---|
| Message-ID | <[email protected]> |
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); -- Email: Herbert Xu <[email protected]> Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt