diff options
| author | Stefan Esser | 2014-06-09 15:59:35 +0200 |
|---|---|---|
| committer | Stefan Esser | 2014-06-09 15:59:35 +0200 |
| commit | 9be1238da0b3f87fe9781a2ca91202061b89c0a1 (patch) | |
| tree | 8348fa3c245565829237c17dd1e39905d5a59b0b /session.c | |
| parent | f073721856bbac1d427f87520a9cfb6c3fa08c5d (diff) | |
Fixed problem with SessionHandler() class and endless recursion
Diffstat (limited to 'session.c')
| -rw-r--r-- | session.c | 11 |
1 files changed, 9 insertions, 2 deletions
| @@ -986,16 +986,20 @@ static int suhosin_hook_s_destroy(void **mod_data, const char *key TSRMLS_DC) | |||
| 986 | static void suhosin_hook_session_module(TSRMLS_D) | 986 | static void suhosin_hook_session_module(TSRMLS_D) |
| 987 | { | 987 | { |
| 988 | ps_module *old_mod = SESSION_G(mod), *mod; | 988 | ps_module *old_mod = SESSION_G(mod), *mod; |
| 989 | 989 | ||
| 990 | if (old_mod == NULL || SUHOSIN_G(s_module) == old_mod) { | 990 | if (old_mod == NULL || SUHOSIN_G(s_module) == old_mod) { |
| 991 | return; | 991 | return; |
| 992 | } | 992 | } |
| 993 | |||
| 993 | if (SUHOSIN_G(s_module) == NULL) { | 994 | if (SUHOSIN_G(s_module) == NULL) { |
| 994 | SUHOSIN_G(s_module) = mod = malloc(sizeof(ps_module)); | 995 | SUHOSIN_G(s_module) = mod = malloc(sizeof(ps_module)); |
| 995 | if (mod == NULL) { | 996 | if (mod == NULL) { |
| 996 | return; | 997 | return; |
| 997 | } | 998 | } |
| 998 | } | 999 | } |
| 1000 | |||
| 1001 | SUHOSIN_G(s_original_mod) = old_mod; | ||
| 1002 | |||
| 999 | mod = SUHOSIN_G(s_module); | 1003 | mod = SUHOSIN_G(s_module); |
| 1000 | memcpy(mod, old_mod, sizeof(ps_module)); | 1004 | memcpy(mod, old_mod, sizeof(ps_module)); |
| 1001 | 1005 | ||
| @@ -1012,11 +1016,14 @@ static void suhosin_hook_session_module(TSRMLS_D) | |||
| 1012 | static PHP_INI_MH(suhosin_OnUpdateSaveHandler) | 1016 | static PHP_INI_MH(suhosin_OnUpdateSaveHandler) |
| 1013 | { | 1017 | { |
| 1014 | int r; | 1018 | int r; |
| 1019 | char *tmp; | ||
| 1015 | 1020 | ||
| 1021 | SESSION_G(mod) = SUHOSIN_G(s_original_mod); | ||
| 1022 | |||
| 1016 | r = old_OnUpdateSaveHandler(entry, new_value, new_value_length, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC); | 1023 | r = old_OnUpdateSaveHandler(entry, new_value, new_value_length, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC); |
| 1017 | 1024 | ||
| 1018 | suhosin_hook_session_module(TSRMLS_C); | 1025 | suhosin_hook_session_module(TSRMLS_C); |
| 1019 | 1026 | ||
| 1020 | return r; | 1027 | return r; |
| 1021 | } | 1028 | } |
| 1022 | 1029 | ||
