Skip to content

Commit a2a55da

Browse files
author
Ilia Alshanetsky
committed
Segment size validation
1 parent 1b8a854 commit a2a55da

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

ext/shmop/shmop.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,11 @@ PHP_FUNCTION(shmop_open)
169169
goto err;
170170
}
171171

172+
if (shmop->size < 1) {
173+
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Shared memory segment size must be greater then zero.");
174+
goto err;
175+
}
176+
172177
shmop->shmid = shmget(shmop->key, shmop->size, shmop->shmflg);
173178
if (shmop->shmid == -1) {
174179
php_error_docref(NULL TSRMLS_CC, E_WARNING, "unable to attach or create shared memory segment");

0 commit comments

Comments
 (0)