]> granicus.if.org Git - php/commitdiff
Segment size validation
authorIlia Alshanetsky <iliaa@php.net>
Sat, 24 Feb 2007 15:50:54 +0000 (15:50 +0000)
committerIlia Alshanetsky <iliaa@php.net>
Sat, 24 Feb 2007 15:50:54 +0000 (15:50 +0000)
ext/shmop/shmop.c

index 397fd59e1e75a4c8a6328d7388aa921464d84ee4..645434d7874e9e85921568ab2f9f68bc1cbfc5f8 100644 (file)
@@ -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");