summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjvoisin2018-01-12 18:22:45 +0100
committerjvoisin2018-01-12 18:22:45 +0100
commitb55b87dc022319ed5049736c7aa8d862d00d7c69 (patch)
tree26eb5167d603023f72d479be8f86b34e4b4f4e8f
parentf6f1c2cc1f75951427e076aa31093c01d8441ded (diff)
Minor factorization and symbol exposure reduction
-rw-r--r--src/sp_disabled_functions.c12
-rw-r--r--src/sp_disabled_functions.h1
2 files changed, 4 insertions, 9 deletions
diff --git a/src/sp_disabled_functions.c b/src/sp_disabled_functions.c
index 6e1b95a..24d4749 100644
--- a/src/sp_disabled_functions.c
+++ b/src/sp_disabled_functions.c
@@ -83,7 +83,7 @@ static bool is_local_var_matching(
83 } else { 83 } else {
84 char* var_value_str = sp_convert_to_string(var_value); 84 char* var_value_str = sp_convert_to_string(var_value);
85 bool match = sp_match_value(var_value_str, config_node->value, 85 bool match = sp_match_value(var_value_str, config_node->value,
86 config_node->value_r); 86 config_node->value_r);
87 efree(var_value_str); 87 efree(var_value_str);
88 88
89 if (true == match) { 89 if (true == match) {
@@ -236,7 +236,7 @@ bool should_disable(zend_execute_data* execute_data, const char* builtin_name,
236 236
237 if (!complete_path_function) { 237 if (!complete_path_function) {
238 if (builtin_name) { 238 if (builtin_name) {
239 complete_path_function = (char*)builtin_name; 239 complete_path_function = estrdup(builtin_name);
240 } else { 240 } else {
241 return false; 241 return false;
242 } 242 }
@@ -329,18 +329,14 @@ bool should_disable(zend_execute_data* execute_data, const char* builtin_name,
329 if (true == config_node->simulation) { 329 if (true == config_node->simulation) {
330 goto next; 330 goto next;
331 } else { // We've got a match, the function won't be executed 331 } else { // We've got a match, the function won't be executed
332 if (builtin_name == NULL) { 332 efree(complete_path_function);
333 efree(complete_path_function);
334 }
335 return true; 333 return true;
336 } 334 }
337 next: 335 next:
338 config = config->next; 336 config = config->next;
339 } 337 }
340allow: 338allow:
341 if (builtin_name == NULL) { 339 efree(complete_path_function);
342 efree(complete_path_function);
343 }
344 return false; 340 return false;
345} 341}
346 342
diff --git a/src/sp_disabled_functions.h b/src/sp_disabled_functions.h
index 9629308..f80c9c2 100644
--- a/src/sp_disabled_functions.h
+++ b/src/sp_disabled_functions.h
@@ -5,6 +5,5 @@ int hook_disabled_functions();
5bool should_disable(zend_execute_data *, const char *, const char *, 5bool should_disable(zend_execute_data *, const char *, const char *,
6 const char *); 6 const char *);
7bool should_drop_on_ret(zval *, const zend_execute_data *const); 7bool should_drop_on_ret(zval *, const zend_execute_data *const);
8char* get_complete_function_path(zend_execute_data const* const execute_data);
9 8
10#endif /* __SP_DISABLE_FUNCTIONS_H */ 9#endif /* __SP_DISABLE_FUNCTIONS_H */