From 9be1238da0b3f87fe9781a2ca91202061b89c0a1 Mon Sep 17 00:00:00 2001 From: Stefan Esser Date: Mon, 9 Jun 2014 15:59:35 +0200 Subject: Fixed problem with SessionHandler() class and endless recursion --- session.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'session.c') diff --git a/session.c b/session.c index f6cff15..306da60 100644 --- a/session.c +++ b/session.c @@ -986,16 +986,20 @@ static int suhosin_hook_s_destroy(void **mod_data, const char *key TSRMLS_DC) static void suhosin_hook_session_module(TSRMLS_D) { ps_module *old_mod = SESSION_G(mod), *mod; - + if (old_mod == NULL || SUHOSIN_G(s_module) == old_mod) { return; } + if (SUHOSIN_G(s_module) == NULL) { SUHOSIN_G(s_module) = mod = malloc(sizeof(ps_module)); if (mod == NULL) { return; } } + + SUHOSIN_G(s_original_mod) = old_mod; + mod = SUHOSIN_G(s_module); memcpy(mod, old_mod, sizeof(ps_module)); @@ -1012,11 +1016,14 @@ static void suhosin_hook_session_module(TSRMLS_D) static PHP_INI_MH(suhosin_OnUpdateSaveHandler) { int r; + char *tmp; + SESSION_G(mod) = SUHOSIN_G(s_original_mod); + r = old_OnUpdateSaveHandler(entry, new_value, new_value_length, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC); suhosin_hook_session_module(TSRMLS_C); - + return r; } -- cgit v1.3