diff options
| author | xXx-caillou-xXx | 2018-08-28 18:16:11 +0200 |
|---|---|---|
| committer | jvoisin | 2018-08-28 16:16:11 +0000 |
| commit | a0300b15a3afffe02c737d263c3d6dd31ac307b7 (patch) | |
| tree | 0f03abc2ae41653c61de2e34a93292b15a200046 /src | |
| parent | 888242c30d822392953e1b5f4fc289a96e9da5e0 (diff) | |
Fix some compilation warnings
Diffstat (limited to 'src')
| -rw-r--r-- | src/sp_config_keywords.c | 20 | ||||
| -rw-r--r-- | src/sp_disabled_functions.c | 2 | ||||
| -rw-r--r-- | src/sp_pcre_compat.c | 2 | ||||
| -rw-r--r-- | src/sp_session.c | 2 | ||||
| -rw-r--r-- | src/sp_sloppy.c | 3 | ||||
| -rw-r--r-- | src/sp_utils.c | 7 | ||||
| -rw-r--r-- | src/sp_utils.h | 1 |
7 files changed, 20 insertions, 17 deletions
diff --git a/src/sp_config_keywords.c b/src/sp_config_keywords.c index 13a2f89..93077c6 100644 --- a/src/sp_config_keywords.c +++ b/src/sp_config_keywords.c | |||
| @@ -10,7 +10,7 @@ static int parse_enable(char *line, bool *restrict retval, | |||
| 10 | {parse_empty, SP_TOKEN_ENABLE, &(enable)}, | 10 | {parse_empty, SP_TOKEN_ENABLE, &(enable)}, |
| 11 | {parse_empty, SP_TOKEN_DISABLE, &(disable)}, | 11 | {parse_empty, SP_TOKEN_DISABLE, &(disable)}, |
| 12 | {parse_empty, SP_TOKEN_SIMULATION, simulation}, | 12 | {parse_empty, SP_TOKEN_SIMULATION, simulation}, |
| 13 | {0}}; | 13 | {0, 0, 0}}; |
| 14 | 14 | ||
| 15 | int ret = parse_keywords(sp_config_funcs, line); | 15 | int ret = parse_keywords(sp_config_funcs, line); |
| 16 | 16 | ||
| @@ -35,7 +35,7 @@ int parse_session(char *line) { | |||
| 35 | sp_config_functions sp_config_funcs_session_encryption[] = { | 35 | sp_config_functions sp_config_funcs_session_encryption[] = { |
| 36 | {parse_empty, SP_TOKEN_ENCRYPT, &(session->encrypt)}, | 36 | {parse_empty, SP_TOKEN_ENCRYPT, &(session->encrypt)}, |
| 37 | {parse_empty, SP_TOKEN_SIMULATION, &(session->simulation)}, | 37 | {parse_empty, SP_TOKEN_SIMULATION, &(session->simulation)}, |
| 38 | {0}}; | 38 | {0, 0, 0}}; |
| 39 | int ret = parse_keywords(sp_config_funcs_session_encryption, line); | 39 | int ret = parse_keywords(sp_config_funcs_session_encryption, line); |
| 40 | if (0 != ret) { | 40 | if (0 != ret) { |
| 41 | return ret; | 41 | return ret; |
| @@ -104,7 +104,7 @@ int parse_unserialize(char *line) { | |||
| 104 | {parse_empty, SP_TOKEN_DISABLE, &(disable)}, | 104 | {parse_empty, SP_TOKEN_DISABLE, &(disable)}, |
| 105 | {parse_empty, SP_TOKEN_SIMULATION, &(unserialize->simulation)}, | 105 | {parse_empty, SP_TOKEN_SIMULATION, &(unserialize->simulation)}, |
| 106 | {parse_str, SP_TOKEN_DUMP, &(unserialize->dump)}, | 106 | {parse_str, SP_TOKEN_DUMP, &(unserialize->dump)}, |
| 107 | {0}}; | 107 | {0, 0, 0}}; |
| 108 | 108 | ||
| 109 | unserialize->textual_representation = zend_string_init(line, strlen(line), 1); | 109 | unserialize->textual_representation = zend_string_init(line, strlen(line), 1); |
| 110 | 110 | ||
| @@ -134,7 +134,7 @@ int parse_readonly_exec(char *line) { | |||
| 134 | {parse_empty, SP_TOKEN_DISABLE, &(disable)}, | 134 | {parse_empty, SP_TOKEN_DISABLE, &(disable)}, |
| 135 | {parse_empty, SP_TOKEN_SIMULATION, &(readonly_exec->simulation)}, | 135 | {parse_empty, SP_TOKEN_SIMULATION, &(readonly_exec->simulation)}, |
| 136 | {parse_str, SP_TOKEN_DUMP, &(readonly_exec->dump)}, | 136 | {parse_str, SP_TOKEN_DUMP, &(readonly_exec->dump)}, |
| 137 | {0}}; | 137 | {0, 0, 0}}; |
| 138 | 138 | ||
| 139 | readonly_exec->textual_representation = | 139 | readonly_exec->textual_representation = |
| 140 | zend_string_init(line, strlen(line), 1); | 140 | zend_string_init(line, strlen(line), 1); |
| @@ -161,7 +161,7 @@ int parse_global(char *line) { | |||
| 161 | &(SNUFFLEUPAGUS_G(config).config_snuffleupagus->encryption_key)}, | 161 | &(SNUFFLEUPAGUS_G(config).config_snuffleupagus->encryption_key)}, |
| 162 | {parse_str, SP_TOKEN_ENV_VAR, | 162 | {parse_str, SP_TOKEN_ENV_VAR, |
| 163 | &(SNUFFLEUPAGUS_G(config).config_snuffleupagus->cookies_env_var)}, | 163 | &(SNUFFLEUPAGUS_G(config).config_snuffleupagus->cookies_env_var)}, |
| 164 | {0}}; | 164 | {0, 0, 0}}; |
| 165 | return parse_keywords(sp_config_funcs_global, line); | 165 | return parse_keywords(sp_config_funcs_global, line); |
| 166 | } | 166 | } |
| 167 | 167 | ||
| @@ -174,7 +174,7 @@ static int parse_eval_filter_conf(char *line, sp_list_node **list) { | |||
| 174 | {parse_empty, SP_TOKEN_SIMULATION, | 174 | {parse_empty, SP_TOKEN_SIMULATION, |
| 175 | &(SNUFFLEUPAGUS_G(config).config_eval->simulation)}, | 175 | &(SNUFFLEUPAGUS_G(config).config_eval->simulation)}, |
| 176 | {parse_str, SP_TOKEN_DUMP, &(SNUFFLEUPAGUS_G(config).config_eval->dump)}, | 176 | {parse_str, SP_TOKEN_DUMP, &(SNUFFLEUPAGUS_G(config).config_eval->dump)}, |
| 177 | {0}}; | 177 | {0, 0, 0}}; |
| 178 | 178 | ||
| 179 | eval->textual_representation = zend_string_init(line, strlen(line), 1); | 179 | eval->textual_representation = zend_string_init(line, strlen(line), 1); |
| 180 | 180 | ||
| @@ -194,7 +194,7 @@ int parse_wrapper_whitelist(char *line) { | |||
| 194 | sp_config_functions sp_config_funcs[] = { | 194 | sp_config_functions sp_config_funcs[] = { |
| 195 | {parse_list, SP_TOKEN_LIST, | 195 | {parse_list, SP_TOKEN_LIST, |
| 196 | &SNUFFLEUPAGUS_G(config).config_wrapper->whitelist}, | 196 | &SNUFFLEUPAGUS_G(config).config_wrapper->whitelist}, |
| 197 | {0}}; | 197 | {0, 0, 0}}; |
| 198 | int ret = parse_keywords(sp_config_funcs, line); | 198 | int ret = parse_keywords(sp_config_funcs, line); |
| 199 | if (0 != ret) { | 199 | if (0 != ret) { |
| 200 | return ret; | 200 | return ret; |
| @@ -223,7 +223,7 @@ int parse_cookie(char *line) { | |||
| 223 | {parse_str, SP_TOKEN_SAMESITE, &samesite}, | 223 | {parse_str, SP_TOKEN_SAMESITE, &samesite}, |
| 224 | {parse_empty, SP_TOKEN_ENCRYPT, &cookie->encrypt}, | 224 | {parse_empty, SP_TOKEN_ENCRYPT, &cookie->encrypt}, |
| 225 | {parse_empty, SP_TOKEN_SIMULATION, &cookie->simulation}, | 225 | {parse_empty, SP_TOKEN_SIMULATION, &cookie->simulation}, |
| 226 | {0}}; | 226 | {0, 0, 0}}; |
| 227 | 227 | ||
| 228 | ret = parse_keywords(sp_config_funcs_cookie_encryption, line); | 228 | ret = parse_keywords(sp_config_funcs_cookie_encryption, line); |
| 229 | if (0 != ret) { | 229 | if (0 != ret) { |
| @@ -338,7 +338,7 @@ int parse_disabled_functions(char *line) { | |||
| 338 | {parse_str, SP_TOKEN_LOCAL_VAR, &(var)}, | 338 | {parse_str, SP_TOKEN_LOCAL_VAR, &(var)}, |
| 339 | {parse_str, SP_TOKEN_VALUE_ARG_POS, &(pos)}, | 339 | {parse_str, SP_TOKEN_VALUE_ARG_POS, &(pos)}, |
| 340 | {parse_str, SP_TOKEN_LINE_NUMBER, &(line_number)}, | 340 | {parse_str, SP_TOKEN_LINE_NUMBER, &(line_number)}, |
| 341 | {0}}; | 341 | {0, 0, 0}}; |
| 342 | 342 | ||
| 343 | ret = parse_keywords(sp_config_funcs_disabled_functions, line); | 343 | ret = parse_keywords(sp_config_funcs_disabled_functions, line); |
| 344 | 344 | ||
| @@ -525,7 +525,7 @@ int parse_upload_validation(char *line) { | |||
| 525 | &(SNUFFLEUPAGUS_G(config).config_upload_validation->simulation)}, | 525 | &(SNUFFLEUPAGUS_G(config).config_upload_validation->simulation)}, |
| 526 | {parse_empty, SP_TOKEN_ENABLE, &(enable)}, | 526 | {parse_empty, SP_TOKEN_ENABLE, &(enable)}, |
| 527 | {parse_empty, SP_TOKEN_DISABLE, &(disable)}, | 527 | {parse_empty, SP_TOKEN_DISABLE, &(disable)}, |
| 528 | {0}}; | 528 | {0, 0, 0}}; |
| 529 | 529 | ||
| 530 | int ret = parse_keywords(sp_config_funcs_upload_validation, line); | 530 | int ret = parse_keywords(sp_config_funcs_upload_validation, line); |
| 531 | 531 | ||
diff --git a/src/sp_disabled_functions.c b/src/sp_disabled_functions.c index 3a30d55..842b15c 100644 --- a/src/sp_disabled_functions.c +++ b/src/sp_disabled_functions.c | |||
| @@ -208,7 +208,7 @@ 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(current_filename, config_node->filename)) { | 211 | if (sp_zend_string_equals(current_filename, config_node->filename)) { |
| 212 | return ex; | 212 | return ex; |
| 213 | } | 213 | } |
| 214 | ITERATE(ex); | 214 | ITERATE(ex); |
diff --git a/src/sp_pcre_compat.c b/src/sp_pcre_compat.c index 3b3b7f5..d58d0c4 100644 --- a/src/sp_pcre_compat.c +++ b/src/sp_pcre_compat.c | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | sp_pcre* sp_pcre_compile(const char* const pattern) { | 5 | sp_pcre* sp_pcre_compile(const char* const pattern) { |
| 6 | sp_pcre* ret = NULL; | 6 | sp_pcre* ret = NULL; |
| 7 | #ifdef SP_HAS_PCRE2 | 7 | #ifdef SP_HAS_PCRE2 |
| 8 | char pcre_error[128] = {0}; | 8 | unsigned char pcre_error[128] = {0}; |
| 9 | int errornumber; | 9 | int errornumber; |
| 10 | PCRE2_SIZE erroroffset; | 10 | PCRE2_SIZE erroroffset; |
| 11 | ret = pcre2_compile((PCRE2_SPTR)pattern, PCRE2_ZERO_TERMINATED, | 11 | ret = pcre2_compile((PCRE2_SPTR)pattern, PCRE2_ZERO_TERMINATED, |
diff --git a/src/sp_session.c b/src/sp_session.c index d23b8b2..35866a1 100644 --- a/src/sp_session.c +++ b/src/sp_session.c | |||
| @@ -10,10 +10,10 @@ static ts_rsrc_id session_globals_id = 0; | |||
| 10 | ZEND_TSRMLS_CACHE_EXTERN(); | 10 | ZEND_TSRMLS_CACHE_EXTERN(); |
| 11 | #endif | 11 | #endif |
| 12 | #else | 12 | #else |
| 13 | static php_ps_globals *session_globals = NULL; | ||
| 13 | #define SESSION_G(v) (ps_globals.v) | 14 | #define SESSION_G(v) (ps_globals.v) |
| 14 | #endif | 15 | #endif |
| 15 | 16 | ||
| 16 | static php_ps_globals *session_globals = NULL; | ||
| 17 | static ps_module *s_module; | 17 | static ps_module *s_module; |
| 18 | static ps_module *s_original_mod; | 18 | static ps_module *s_original_mod; |
| 19 | static int (*old_s_read)(PS_READ_ARGS); | 19 | static int (*old_s_read)(PS_READ_ARGS); |
diff --git a/src/sp_sloppy.c b/src/sp_sloppy.c index e7396fd..5b36026 100644 --- a/src/sp_sloppy.c +++ b/src/sp_sloppy.c | |||
| @@ -41,10 +41,11 @@ static void array_handler(INTERNAL_FUNCTION_PARAMETERS, | |||
| 41 | void (*orig_handler)(INTERNAL_FUNCTION_PARAMETERS)) { | 41 | void (*orig_handler)(INTERNAL_FUNCTION_PARAMETERS)) { |
| 42 | void (*handler)(INTERNAL_FUNCTION_PARAMETERS); | 42 | void (*handler)(INTERNAL_FUNCTION_PARAMETERS); |
| 43 | zval func_name; | 43 | zval func_name; |
| 44 | zval params[3] = {{{0}}}; | 44 | zval params[3]; |
| 45 | zval *value, *array; | 45 | zval *value, *array; |
| 46 | zend_bool strict; | 46 | zend_bool strict; |
| 47 | 47 | ||
| 48 | memset(¶ms, 0, sizeof(params)); | ||
| 48 | zend_parse_parameters(ZEND_NUM_ARGS(), "zz|b", &value, &array, &strict); | 49 | zend_parse_parameters(ZEND_NUM_ARGS(), "zz|b", &value, &array, &strict); |
| 49 | 50 | ||
| 50 | ZVAL_COPY(¶ms[0], value); | 51 | ZVAL_COPY(¶ms[0], value); |
diff --git a/src/sp_utils.c b/src/sp_utils.c index cb6b4a7..41d817e 100644 --- a/src/sp_utils.c +++ b/src/sp_utils.c | |||
| @@ -9,8 +9,8 @@ | |||
| 9 | 9 | ||
| 10 | ZEND_DECLARE_MODULE_GLOBALS(snuffleupagus) | 10 | ZEND_DECLARE_MODULE_GLOBALS(snuffleupagus) |
| 11 | 11 | ||
| 12 | static bool sp_zend_string_equals(const zend_string* s1, | 12 | bool sp_zend_string_equals(const zend_string* s1, |
| 13 | const zend_string* s2) { | 13 | const zend_string* s2) { |
| 14 | // We can't use `zend_string_equals` here because it doesn't work on | 14 | // We can't use `zend_string_equals` here because it doesn't work on |
| 15 | // `const` zend_string. | 15 | // `const` zend_string. |
| 16 | return ZSTR_LEN(s1) == ZSTR_LEN(s2) && | 16 | return ZSTR_LEN(s1) == ZSTR_LEN(s2) && |
| @@ -113,8 +113,9 @@ int sp_log_request(const zend_string* folder, const zend_string* text_repr, | |||
| 113 | HashTable* ht = Z_ARRVAL(PG(http_globals)[zones[i].key]); | 113 | HashTable* ht = Z_ARRVAL(PG(http_globals)[zones[i].key]); |
| 114 | fprintf(file, "%s:", zones[i].str); | 114 | fprintf(file, "%s:", zones[i].str); |
| 115 | ZEND_HASH_FOREACH_STR_KEY_VAL(ht, variable_key, variable_value) { | 115 | ZEND_HASH_FOREACH_STR_KEY_VAL(ht, variable_key, variable_value) { |
| 116 | smart_str a = {0}; | 116 | smart_str a; |
| 117 | 117 | ||
| 118 | memset(&a, 0, sizeof(a)); | ||
| 118 | php_var_export_ex(variable_value, 1, &a); | 119 | php_var_export_ex(variable_value, 1, &a); |
| 119 | ZSTR_VAL(a.s)[ZSTR_LEN(a.s)] = '\0'; | 120 | ZSTR_VAL(a.s)[ZSTR_LEN(a.s)] = '\0'; |
| 120 | fprintf(file, "%s=%s ", ZSTR_VAL(variable_key), ZSTR_VAL(a.s)); | 121 | fprintf(file, "%s=%s ", ZSTR_VAL(variable_key), ZSTR_VAL(a.s)); |
diff --git a/src/sp_utils.h b/src/sp_utils.h index 62040e7..97c97fd 100644 --- a/src/sp_utils.h +++ b/src/sp_utils.h | |||
| @@ -61,5 +61,6 @@ int hook_regexp(const sp_pcre *, HashTable *, | |||
| 61 | bool check_is_in_eval_whitelist(const zend_string *const function_name); | 61 | bool check_is_in_eval_whitelist(const zend_string *const function_name); |
| 62 | int sp_log_request(const zend_string *folder, const zend_string *text_repr, | 62 | int sp_log_request(const zend_string *folder, const zend_string *text_repr, |
| 63 | char *from); | 63 | char *from); |
| 64 | bool sp_zend_string_equals(const zend_string* s1, const zend_string* s2); | ||
| 64 | 65 | ||
| 65 | #endif /* SP_UTILS_H */ | 66 | #endif /* SP_UTILS_H */ |
