summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorxXx-caillou-xXx2018-08-20 10:50:58 +0200
committerjvoisin2018-08-20 08:50:58 +0000
commit2105928a9848dac1867d681ee9e004595ea73089 (patch)
tree04c35c637bf259c107aa4c4abb697158b0f7898f
parentd538eef4fb62174ea32d94e28f1f5a20c5094426 (diff)
Fix two minor issues
- Fix an infinite loop on `echo` hook - Use the correct function to compare filenames internally
-rw-r--r--src/snuffleupagus.c6
-rw-r--r--src/sp_disabled_functions.c4
2 files changed, 6 insertions, 4 deletions
diff --git a/src/snuffleupagus.c b/src/snuffleupagus.c
index 3f9e1eb..ff0c6c3 100644
--- a/src/snuffleupagus.c
+++ b/src/snuffleupagus.c
@@ -265,12 +265,14 @@ static PHP_INI_MH(OnUpdateConfiguration) {
265 // This is needed to implement the global strict mode 265 // This is needed to implement the global strict mode
266 CG(compiler_options) |= ZEND_COMPILE_HANDLE_OP_ARRAY; 266 CG(compiler_options) |= ZEND_COMPILE_HANDLE_OP_ARRAY;
267 } 267 }
268 if (zend_hash_str_find( 268
269 // If `zend_write_default` is not NULL it is already hooked.
270 if ((zend_hash_str_find(
269 SNUFFLEUPAGUS_G(config).config_disabled_functions_hooked, "echo", 271 SNUFFLEUPAGUS_G(config).config_disabled_functions_hooked, "echo",
270 strlen("echo")) || 272 strlen("echo")) ||
271 zend_hash_str_find( 273 zend_hash_str_find(
272 SNUFFLEUPAGUS_G(config).config_disabled_functions_ret_hooked, "echo", 274 SNUFFLEUPAGUS_G(config).config_disabled_functions_ret_hooked, "echo",
273 strlen("echo"))) { 275 strlen("echo"))) && NULL == zend_write_default) {
274 zend_write_default = zend_write; 276 zend_write_default = zend_write;
275 zend_write = hook_echo; 277 zend_write = hook_echo;
276 } 278 }
diff --git a/src/sp_disabled_functions.c b/src/sp_disabled_functions.c
index 4a4f7d8..b498732 100644
--- a/src/sp_disabled_functions.c
+++ b/src/sp_disabled_functions.c
@@ -208,11 +208,11 @@ static zend_execute_data* is_file_matching(
208 208
209 zend_execute_data* ex = execute_data; 209 zend_execute_data* ex = execute_data;
210 if (config_node->filename) { 210 if (config_node->filename) {
211 if (zend_string_equals_literal(current_filename, config_node->filename)) { 211 if (zend_string_equals(current_filename, config_node->filename)) {
212 return ex; 212 return ex;
213 } 213 }
214 ITERATE(ex); 214 ITERATE(ex);
215 if (zend_string_equals_literal(ex->func->op_array.filename, 215 if (zend_string_equals(ex->func->op_array.filename,
216 config_node->filename)) { 216 config_node->filename)) {
217 return ex; 217 return ex;
218 } 218 }