From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL autolearn=ham autolearn_force=no version=3.4.4 Received: from second.openwall.net (second.openwall.net [193.110.157.125]) by inbox.vuxu.org (Postfix) with SMTP id AC8682CA75 for ; Tue, 5 Nov 2024 02:47:07 +0100 (CET) Received: (qmail 13844 invoked by uid 550); 5 Nov 2024 01:47:02 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Reply-To: musl@lists.openwall.com x-ms-reactions: disallow Received: (qmail 13799 invoked from network); 5 Nov 2024 01:47:01 -0000 Date: Mon, 4 Nov 2024 20:46:53 -0500 From: Rich Felker To: lihua.zhao.cn@windriver.com Cc: musl@lists.openwall.com Message-ID: <20241105014652.GE10433@brightrain.aerifal.cx> References: <20241105010633.1512010-1-lihua.zhao.cn@windriver.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20241105010633.1512010-1-lihua.zhao.cn@windriver.com> User-Agent: Mutt/1.5.21 (2010-09-15) Subject: Re: [musl] [PATCH] mman: correct length check in __shm_mapname On Tue, Nov 05, 2024 at 09:06:33AM +0800, lihua.zhao.cn@windriver.com wrote: > From: Lihua Zhao > > 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 > --- > 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