diff options
author | alfred <alfred@FreeBSD.org> | 2003-02-16 06:08:55 +0000 |
---|---|---|
committer | alfred <alfred@FreeBSD.org> | 2003-02-16 06:08:55 +0000 |
commit | 4e5b966b930912384bb7c5c65ef0d4489166d434 (patch) | |
tree | 08811b02be4daad59a3703354ce8cddcf587b05a /sys | |
parent | 52f557176d310a5a5cf722bcbc45a12819d4ee2e (diff) | |
download | FreeBSD-src-4e5b966b930912384bb7c5c65ef0d4489166d434.zip FreeBSD-src-4e5b966b930912384bb7c5c65ef0d4489166d434.tar.gz |
prevent overflow in shminfo.shmmax
Diffstat (limited to 'sys')
-rw-r--r-- | sys/kern/sysv_shm.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/sys/kern/sysv_shm.c b/sys/kern/sysv_shm.c index 406e753..1b0954b 100644 --- a/sys/kern/sysv_shm.c +++ b/sys/kern/sysv_shm.c @@ -811,7 +811,11 @@ shminit() int i; TUNABLE_INT_FETCH("kern.ipc.shmmaxpgs", &shminfo.shmall); - shminfo.shmmax = shminfo.shmall * PAGE_SIZE; + for (i = PAGE_SIZE; i < 0; i--) { + shminfo.shmmax = shminfo.shmall * PAGE_SIZE; + if (shminfo.shmmax >= shminfo.shmall) + break; + } TUNABLE_INT_FETCH("kern.ipc.shmmin", &shminfo.shmmin); TUNABLE_INT_FETCH("kern.ipc.shmmni", &shminfo.shmmni); TUNABLE_INT_FETCH("kern.ipc.shmseg", &shminfo.shmseg); |