From e39fbeae1687977d8f557c2c608c2592848fad11 Mon Sep 17 00:00:00 2001 From: Derick Rethans Date: Thu, 22 Nov 2001 14:33:35 +0000 Subject: [PATCH] - Fix crach bug if the parameter to shm_remove is not a valid identifier. --- ext/sysvshm/sysvshm.c | 6 ++++++ 1 file changed, 6 insertions(+) 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; -- 2.40.0