summaryrefslogtreecommitdiff
path: root/ext/sysvshm/sysvshm.c
diff options
context:
space:
mode:
authorIlia Alshanetsky <iliaa@php.net>2007-02-24 15:44:43 +0000
committerIlia Alshanetsky <iliaa@php.net>2007-02-24 15:44:43 +0000
commite4ff13e43e13e1bc0c9a3a7500668b6986f9b0e8 (patch)
treec4dcc64ec89e504bafce93d86858f73781207b46 /ext/sysvshm/sysvshm.c
parent44aefd1ea07eae2d1bb9893925dd4e4cc2665614 (diff)
downloadphp-git-e4ff13e43e13e1bc0c9a3a7500668b6986f9b0e8.tar.gz
Unify validation of shm segment size inside shm_attach()
Diffstat (limited to 'ext/sysvshm/sysvshm.c')
-rw-r--r--ext/sysvshm/sysvshm.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/ext/sysvshm/sysvshm.c b/ext/sysvshm/sysvshm.c
index c2dfbab5bd..c8092ef2cc 100644
--- a/ext/sysvshm/sysvshm.c
+++ b/ext/sysvshm/sysvshm.c
@@ -134,6 +134,11 @@ PHP_FUNCTION(shm_attach)
shm_key = Z_LVAL_PP(arg_key);
}
+ if (shm_size < 1) {
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Segment size must be greater then zero.");
+ RETURN_FALSE;
+ }
+
shm_list_ptr = (sysvshm_shm *) emalloc(sizeof(sysvshm_shm));
/* get the id from a specified key or create new shared memory */