summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sys/kern/sysv_sem.c6
-rw-r--r--sys/kern/sysv_shm.c6
2 files changed, 6 insertions, 6 deletions
diff --git a/sys/kern/sysv_sem.c b/sys/kern/sysv_sem.c
index f72d77ccc2f..f848aebf92a 100644
--- a/sys/kern/sysv_sem.c
+++ b/sys/kern/sysv_sem.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sysv_sem.c,v 1.15 2002/12/30 19:57:34 millert Exp $ */
+/* $OpenBSD: sysv_sem.c,v 1.16 2003/01/07 00:34:41 millert Exp $ */
/* $NetBSD: sysv_sem.c,v 1.26 1996/02/09 19:00:25 christos Exp $ */
/*
@@ -869,8 +869,8 @@ sysctl_sysvsem(int *name, u_int namelen, void *oldp, size_t *oldlenp,
val == seminfo.semmni)
return (error);
- if (val < seminfo.semmni)
- return (EINVAL); /* can't decrease semmni */
+ if (val < seminfo.semmni || val > 0xffff)
+ return (EINVAL);
/* Expand semsegs and semseqs arrays */
sema_new = malloc(val * sizeof(struct semid_ds *),
diff --git a/sys/kern/sysv_shm.c b/sys/kern/sysv_shm.c
index 8f19a889d76..aaf85095b1a 100644
--- a/sys/kern/sysv_shm.c
+++ b/sys/kern/sysv_shm.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sysv_shm.c,v 1.32 2003/01/06 20:11:28 millert Exp $ */
+/* $OpenBSD: sysv_shm.c,v 1.33 2003/01/07 00:34:41 millert Exp $ */
/* $NetBSD: sysv_shm.c,v 1.50 1998/10/21 22:24:29 tron Exp $ */
/*
@@ -606,8 +606,8 @@ sysctl_sysvshm(int *name, u_int namelen, void *oldp, size_t *oldlenp,
val == shminfo.shmmni)
return (error);
- if (val < shminfo.shmmni)
- return (EINVAL); /* can't decrease shmmni */
+ if (val < shminfo.shmmni || val > 0xffff)
+ return (EINVAL);
/* Expand shmsegs and shmseqs arrays */
newsegs = malloc(val * sizeof(struct shmid_ds *),