From a2a55daf213a1ad0925914abe55013be796dd35c Mon Sep 17 00:00:00 2001 From: Ilia Alshanetsky Date: Sat, 24 Feb 2007 15:50:54 +0000 Subject: [PATCH] Segment size validation --- ext/shmop/shmop.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ext/shmop/shmop.c b/ext/shmop/shmop.c index 397fd59e1e7..645434d7874 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");