diff options
| author | jvoisin | 2018-01-04 15:59:59 +0100 |
|---|---|---|
| committer | GitHub | 2018-01-04 15:59:59 +0100 |
| commit | 3b113be573cdbca20ce9ec9c0a6efb25ccf51db5 (patch) | |
| tree | 5fabbd1da7cd740f26354ffbd2234eba71ffdead /src/snuffleupagus.c | |
| parent | 84e423300c440e96c34ada2620e0f78f827592e8 (diff) | |
Eval blacklist
Add support for eval filtering, only blacklist for now
Diffstat (limited to 'src/snuffleupagus.c')
| -rw-r--r-- | src/snuffleupagus.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/snuffleupagus.c b/src/snuffleupagus.c index dd2d941..a3a2fa8 100644 --- a/src/snuffleupagus.c +++ b/src/snuffleupagus.c | |||
| @@ -53,6 +53,8 @@ ZEND_DLEXPORT zend_extension zend_extension_entry = { | |||
| 53 | STANDARD_ZEND_EXTENSION_PROPERTIES}; | 53 | STANDARD_ZEND_EXTENSION_PROPERTIES}; |
| 54 | 54 | ||
| 55 | PHP_GINIT_FUNCTION(snuffleupagus) { | 55 | PHP_GINIT_FUNCTION(snuffleupagus) { |
| 56 | snuffleupagus_globals->in_eval = false; | ||
| 57 | |||
| 56 | #define SP_INIT(F) F = pecalloc(sizeof(*F), 1, 1); | 58 | #define SP_INIT(F) F = pecalloc(sizeof(*F), 1, 1); |
| 57 | #define SP_INIT_HT(F) \ | 59 | #define SP_INIT_HT(F) \ |
| 58 | F = pemalloc(sizeof(*F), 1); \ | 60 | F = pemalloc(sizeof(*F), 1); \ |
| @@ -60,6 +62,7 @@ PHP_GINIT_FUNCTION(snuffleupagus) { | |||
| 60 | 62 | ||
| 61 | SP_INIT_HT(snuffleupagus_globals->disabled_functions_hook); | 63 | SP_INIT_HT(snuffleupagus_globals->disabled_functions_hook); |
| 62 | SP_INIT_HT(snuffleupagus_globals->sp_internal_functions_hook); | 64 | SP_INIT_HT(snuffleupagus_globals->sp_internal_functions_hook); |
| 65 | SP_INIT_HT(snuffleupagus_globals->sp_eval_filter_functions_hook); | ||
| 63 | 66 | ||
| 64 | SP_INIT(snuffleupagus_globals->config.config_unserialize); | 67 | SP_INIT(snuffleupagus_globals->config.config_unserialize); |
| 65 | SP_INIT(snuffleupagus_globals->config.config_random); | 68 | SP_INIT(snuffleupagus_globals->config.config_random); |
| @@ -73,6 +76,7 @@ PHP_GINIT_FUNCTION(snuffleupagus) { | |||
| 73 | SP_INIT(snuffleupagus_globals->config.config_disabled_functions_ret); | 76 | SP_INIT(snuffleupagus_globals->config.config_disabled_functions_ret); |
| 74 | SP_INIT(snuffleupagus_globals->config.config_cookie); | 77 | SP_INIT(snuffleupagus_globals->config.config_cookie); |
| 75 | SP_INIT(snuffleupagus_globals->config.config_disabled_constructs); | 78 | SP_INIT(snuffleupagus_globals->config.config_disabled_constructs); |
| 79 | SP_INIT(snuffleupagus_globals->config.config_eval); | ||
| 76 | 80 | ||
| 77 | snuffleupagus_globals->config.config_disabled_constructs->construct_include = | 81 | snuffleupagus_globals->config.config_disabled_constructs->construct_include = |
| 78 | sp_list_new(); | 82 | sp_list_new(); |
| @@ -83,6 +87,8 @@ PHP_GINIT_FUNCTION(snuffleupagus) { | |||
| 83 | snuffleupagus_globals->config.config_disabled_functions_ret | 87 | snuffleupagus_globals->config.config_disabled_functions_ret |
| 84 | ->disabled_functions = sp_list_new(); | 88 | ->disabled_functions = sp_list_new(); |
| 85 | snuffleupagus_globals->config.config_cookie->cookies = sp_list_new(); | 89 | snuffleupagus_globals->config.config_cookie->cookies = sp_list_new(); |
| 90 | snuffleupagus_globals->config.config_eval->blacklist = sp_list_new(); | ||
| 91 | snuffleupagus_globals->config.config_eval->whitelist = sp_list_new(); | ||
| 86 | 92 | ||
| 87 | #undef SP_INIT | 93 | #undef SP_INIT |
| 88 | #undef SP_INIT_HT | 94 | #undef SP_INIT_HT |
| @@ -100,6 +106,7 @@ PHP_MSHUTDOWN_FUNCTION(snuffleupagus) { | |||
| 100 | pefree(SNUFFLEUPAGUS_G(F), 1); | 106 | pefree(SNUFFLEUPAGUS_G(F), 1); |
| 101 | 107 | ||
| 102 | FREE_HT(disabled_functions_hook); | 108 | FREE_HT(disabled_functions_hook); |
| 109 | FREE_HT(sp_eval_filter_functions_hook); | ||
| 103 | 110 | ||
| 104 | #undef FREE_HT | 111 | #undef FREE_HT |
| 105 | 112 | ||
| @@ -124,6 +131,8 @@ PHP_MSHUTDOWN_FUNCTION(snuffleupagus) { | |||
| 124 | FREE_LST_DISABLE(config.config_disabled_constructs->construct_include); | 131 | FREE_LST_DISABLE(config.config_disabled_constructs->construct_include); |
| 125 | FREE_LST_DISABLE(config.config_disabled_constructs->construct_eval); | 132 | FREE_LST_DISABLE(config.config_disabled_constructs->construct_eval); |
| 126 | sp_list_free(SNUFFLEUPAGUS_G(config).config_cookie->cookies); | 133 | sp_list_free(SNUFFLEUPAGUS_G(config).config_cookie->cookies); |
| 134 | sp_list_free(SNUFFLEUPAGUS_G(config).config_eval->blacklist); | ||
| 135 | sp_list_free(SNUFFLEUPAGUS_G(config).config_eval->whitelist); | ||
| 127 | 136 | ||
| 128 | #undef FREE_LST_DISABLE | 137 | #undef FREE_LST_DISABLE |
| 129 | 138 | ||
