|
|
Message-ID: <20241105010633.1512010-1-lihua.zhao.cn@windriver.com>
Date: Tue, 5 Nov 2024 09:06:33 +0800
From: <lihua.zhao.cn@...driver.com>
To: <musl@...ts.openwall.com>
CC: <lihua.zhao.cn@...driver.com>
Subject: [PATCH] mman: correct length check in __shm_mapname
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
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.