summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDerick Rethans <derick@php.net>2001-11-22 14:33:35 +0000
committerDerick Rethans <derick@php.net>2001-11-22 14:33:35 +0000
commite39fbeae1687977d8f557c2c608c2592848fad11 (patch)
tree2fffd60720b9143f1688a20828a6bcf36a3f2c8e
parent2d6842b103764fd564e836c5c34e1f08b659ab93 (diff)
downloadphp-git-e39fbeae1687977d8f557c2c608c2592848fad11.tar.gz
- Fix crach bug if the parameter to shm_remove is not a valid identifier.
-rw-r--r--ext/sysvshm/sysvshm.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/ext/sysvshm/sysvshm.c b/ext/sysvshm/sysvshm.c
index 706da57067..dba37181a0 100644
--- a/ext/sysvshm/sysvshm.c
+++ b/ext/sysvshm/sysvshm.c
@@ -208,6 +208,12 @@ PHP_FUNCTION(shm_remove)
id = Z_LVAL_PP(arg_id);
shm_list_ptr = (sysvshm_shm *) zend_list_find(id, &type);
+
+ if (!shm_list_ptr) {
+ php_error(E_WARNING, "The parameter is not a valid shm_indentifier");
+ RETURN_FALSE;
+ }
+
if(shmctl(shm_list_ptr->id,IPC_RMID,NULL)<0) {
php_error(E_WARNING, "shm_remove() failed for key 0x%x, id %i: %s", shm_list_ptr->key, id,strerror(errno));
RETURN_FALSE;