summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>2003-01-07 00:34:42 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>2003-01-07 00:34:42 +0000
commit088b30db1f5a9d41a02ce87bb1c95da854dbfc9b (patch)
treeeecda122ff71416c220be2ac9d7fdcf3f77ff522 /sys
parentb8a924f0576eb6845beffa1a28232bc009581d06 (diff)
xerxes [/home/src/local/millert/sudo/sudo-1.6.7] % vi /usr/src/local/TiVo/Linux/Don't allow s{e,h}mmni to be set > 0xffff via sysctl since that could
cause id collisions (the macros in <sys/ipc.h> limit the index to 0xffff). Prompted by a conversation with weingart@
Diffstat (limited to 'sys')
-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 *),