cvs: php-src /ext/spl spl_directory.c
| From: | Antony Dovgal | Date: | Wed, 02 Jul 2008 10:46:52 +0000 |
| Subject: | cvs: php-src /ext/spl spl_directory.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-50744@lists.php.net to get a copy of this message | ||
tony2001 Wed Jul 2 10:46:52 2008 UTC
Modified files:
/php-src/ext/spl spl_directory.c
Log:
use zend_ascii_hash_find() and check its return value to prevent crash when function not found
http://cvs.php.net/viewvc.cgi/php-src/ext/spl/spl_directory.c?r1=1.156&r2=1.157&diff_format=u
Index: php-src/ext/spl/spl_directory.c
diff -u php-src/ext/spl/spl_directory.c:1.156 php-src/ext/spl/spl_directory.c:1.157
--- php-src/ext/spl/spl_directory.c:1.156 Wed Jun 18 10:05:14 2008
+++ php-src/ext/spl/spl_directory.c Wed Jul 2 10:46:52 2008
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: spl_directory.c,v 1.156 2008/06/18 10:05:14 colder Exp $ */
+/* $Id: spl_directory.c,v 1.157 2008/07/02 10:46:52 tony2001 Exp $ */
#ifdef HAVE_CONFIG_H
# include "config.h"
@@ -1870,7 +1870,12 @@
#define FileFunctionCall(func_name, pass_num_args, arg2) /* {{{ */\
{ \
zend_function *func_ptr; \
- zend_hash_find(EG(function_table), #func_name, sizeof(#func_name), (void **) &func_ptr); \
+ int ret; \
+ ret = zend_ascii_hash_find(EG(function_table), #func_name, sizeof(#func_name), (void **)
&func_ptr); \
+ if (ret != SUCCESS) { \
+ zend_throw_exception_ex(spl_ce_RuntimeException, 0 TSRMLS_CC, "Internal error, function
'%s' not found. Please report", #func_name); \
+ return; \
+ } \
spl_filesystem_file_call(intern, func_ptr, pass_num_args, return_value, arg2 TSRMLS_CC); \
} /* }}} */