prevent overflow in shminfo.shmmax

This commit is contained in:
alfred 2003-02-16 06:08:55 +00:00
parent 52f557176d
commit 4e5b966b93

View File

@ -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);