|
|
Message-ID: <20241105014652.GE10433@brightrain.aerifal.cx>
Date: Mon, 4 Nov 2024 20:46:53 -0500
From: Rich Felker <dalias@...c.org>
To: lihua.zhao.cn@...driver.com
Cc: musl@...ts.openwall.com
Subject: Re: [PATCH] mman: correct length check in __shm_mapname
On Tue, Nov 05, 2024 at 09:06:33AM +0800, lihua.zhao.cn@...driver.com wrote:
> From: Lihua Zhao <lihua.zhao.cn@...driver.com>
>
> changed the length check from `p-name > NAME_MAX` to
> `p-name >= NAME_MAX` to correctly account for the null terminator.
>
> Signed-off-by: Lihua Zhao <lihua.zhao.cn@...driver.com>
> ---
> src/mman/shm_open.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/src/mman/shm_open.c b/src/mman/shm_open.c
> index 79784bd3..2359f067 100644
> --- a/src/mman/shm_open.c
> +++ b/src/mman/shm_open.c
> @@ -15,7 +15,7 @@ char *__shm_mapname(const char *name, char *buf)
> errno = EINVAL;
> return 0;
> }
> - if (p-name > NAME_MAX) {
> + if (p-name >= NAME_MAX) {
> errno = ENAMETOOLONG;
> return 0;
> }
> --
> 2.43.0
This doesn't look correct. Can you explain what problem you think it's
solving?
Rich
Powered by blists - more mailing lists
Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.