summaryrefslogtreecommitdiff
path: root/ext/shmop
diff options
context:
space:
mode:
Diffstat (limited to 'ext/shmop')
-rw-r--r--ext/shmop/shmop.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/ext/shmop/shmop.c b/ext/shmop/shmop.c
index 397fd59..645434d 100644
--- a/ext/shmop/shmop.c
+++ b/ext/shmop/shmop.c
@@ -169,6 +169,11 @@ PHP_FUNCTION(shmop_open)
goto err;
}
+ if (shmop->size < 1) {
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Shared memory segment size must be greater then zero.");
+ goto err;
+ }
+
shmop->shmid = shmget(shmop->key, shmop->size, shmop->shmflg);
if (shmop->shmid == -1) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "unable to attach or create shared memory segment");