diff options
Diffstat (limited to 'src/sp_unserialize.c')
| -rw-r--r-- | src/sp_unserialize.c | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/src/sp_unserialize.c b/src/sp_unserialize.c index 9ed1c55..ab0139a 100644 --- a/src/sp_unserialize.c +++ b/src/sp_unserialize.c | |||
| @@ -7,7 +7,8 @@ PHP_FUNCTION(sp_serialize) { | |||
| 7 | 7 | ||
| 8 | /* Call the original `serialize` function. */ | 8 | /* Call the original `serialize` function. */ |
| 9 | orig_handler = zend_hash_str_find_ptr( | 9 | orig_handler = zend_hash_str_find_ptr( |
| 10 | SNUFFLEUPAGUS_G(sp_internal_functions_hook), "serialize", 9); | 10 | SNUFFLEUPAGUS_G(sp_internal_functions_hook), "serialize", |
| 11 | sizeof("serialize") - 1); | ||
| 11 | orig_handler(INTERNAL_FUNCTION_PARAM_PASSTHRU); | 12 | orig_handler(INTERNAL_FUNCTION_PARAM_PASSTHRU); |
| 12 | 13 | ||
| 13 | /* Compute the HMAC of the textual representation of the serialized data*/ | 14 | /* Compute the HMAC of the textual representation of the serialized data*/ |
| @@ -50,6 +51,9 @@ PHP_FUNCTION(sp_unserialize) { | |||
| 50 | size_t buf_len = 0; | 51 | size_t buf_len = 0; |
| 51 | zval *opts = NULL; | 52 | zval *opts = NULL; |
| 52 | 53 | ||
| 54 | const sp_config_unserialize* config_unserialize = | ||
| 55 | SNUFFLEUPAGUS_G(config).config_unserialize; | ||
| 56 | |||
| 53 | if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|a", &buf, &buf_len, &opts) == | 57 | if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|a", &buf, &buf_len, &opts) == |
| 54 | FAILURE) { | 58 | FAILURE) { |
| 55 | RETURN_FALSE; | 59 | RETURN_FALSE; |
| @@ -85,16 +89,17 @@ PHP_FUNCTION(sp_unserialize) { | |||
| 85 | 89 | ||
| 86 | if (0 == status) { | 90 | if (0 == status) { |
| 87 | if ((orig_handler = zend_hash_str_find_ptr( | 91 | if ((orig_handler = zend_hash_str_find_ptr( |
| 88 | SNUFFLEUPAGUS_G(sp_internal_functions_hook), "unserialize", 11))) { | 92 | SNUFFLEUPAGUS_G(sp_internal_functions_hook), "unserialize", |
| 93 | sizeof("unserialize") - 1))) { | ||
| 89 | orig_handler(INTERNAL_FUNCTION_PARAM_PASSTHRU); | 94 | orig_handler(INTERNAL_FUNCTION_PARAM_PASSTHRU); |
| 90 | } | 95 | } |
| 91 | } else { | 96 | } else { |
| 92 | if (true == SNUFFLEUPAGUS_G(config).config_unserialize->simulation) { | 97 | if (true == config_unserialize->simulation) { |
| 93 | sp_log_msg("unserialize", SP_LOG_SIMULATION, "Invalid HMAC for %s", | 98 | sp_log_msg("unserialize", SP_LOG_SIMULATION, "Invalid HMAC for %s", |
| 94 | serialized_str); | 99 | serialized_str); |
| 95 | if ((orig_handler = zend_hash_str_find_ptr( | 100 | if ((orig_handler = zend_hash_str_find_ptr( |
| 96 | SNUFFLEUPAGUS_G(sp_internal_functions_hook), "unserialize", | 101 | SNUFFLEUPAGUS_G(sp_internal_functions_hook), "unserialize", |
| 97 | 11))) { | 102 | sizeof("unserialize") - 1))) { |
| 98 | orig_handler(INTERNAL_FUNCTION_PARAM_PASSTHRU); | 103 | orig_handler(INTERNAL_FUNCTION_PARAM_PASSTHRU); |
| 99 | } | 104 | } |
| 100 | } else { | 105 | } else { |
| @@ -102,10 +107,9 @@ PHP_FUNCTION(sp_unserialize) { | |||
| 102 | serialized_str); | 107 | serialized_str); |
| 103 | } | 108 | } |
| 104 | } | 109 | } |
| 105 | if (SNUFFLEUPAGUS_G(config).config_unserialize->dump) { | 110 | if (config_unserialize->dump) { |
| 106 | sp_log_request( | 111 | sp_log_request(config_unserialize->dump, |
| 107 | SNUFFLEUPAGUS_G(config).config_unserialize->dump, | 112 | config_unserialize->textual_representation, |
| 108 | SNUFFLEUPAGUS_G(config).config_unserialize->textual_representation, | ||
| 109 | SP_TOKEN_UNSERIALIZE_HMAC); | 113 | SP_TOKEN_UNSERIALIZE_HMAC); |
| 110 | } | 114 | } |
| 111 | efree(serialized_str); | 115 | efree(serialized_str); |
