Re: [PATCH 2/2] expand: pmatch(): Fix buffer overread caused by passing array of chars as string

Herbert Xu <[email protected]> Sat, 3 May 2025 15:23:15 +0800
Newsgroups org.kernel.vger.dash
Message-ID <[email protected]>
Zurab Kvachadze <[email protected]> wrote:
> strpbrk() accepts two null-terminated string arguments. stop[] is char
> array that is not null-terminated but is still passed as a second
> argument to strpbrk. This causes buffer overread, which is detected by
> AddressSanitizer.
> 
> This commit adds an explicit null-terminated to the end of the array.
> 
> Signed-off-by: Zurab Kvachadze <[email protected]>
> ---
> src/expand.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)

Patch applied.  Thanks.
-- 
Email: Herbert Xu <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt