Fix index out of bound when key of semget too large

This commit is contained in:
Marsman1996
2024-09-04 15:34:56 +08:00
committed by Tate, Hongliang Tian
parent c68302f700
commit 42f3411337

View File

@ -235,6 +235,9 @@ pub fn create_sem_set_with_id(
) -> Result<()> {
debug_assert!(nsems <= SEMMSL);
debug_assert!(id > 0);
if id as usize > SEMMNI {
return_errno_with_message!(Errno::ENOENT, "id larger than SEMMNI");
}
ID_ALLOCATOR
.get()