diff options
author | Alexander Feldman <sasha@php.net> | 2000-10-23 13:10:01 +0000 |
---|---|---|
committer | Alexander Feldman <sasha@php.net> | 2000-10-23 13:10:01 +0000 |
commit | 7c11cfaf038508daf17fc20e1f0ab39f5a9729b7 (patch) | |
tree | fd41df719bd695a3778ae236573c51262ce05a04 | |
parent | 86c0d81253f62414384c6c92f9283e545dfccfc7 (diff) | |
download | php-git-7c11cfaf038508daf17fc20e1f0ab39f5a9729b7.tar.gz |
Fixed a bug in session.c. If the user calls session_module_name with a
parameter, then the mod_data pointer is initialized to NULL and then
php_session_save_current_state did not check this value before referencing
the pointer. Added a check in php_session_save_current_state.
-rw-r--r-- | NEWS | 3 | ||||
-rw-r--r-- | ext/session/session.c | 18 |
2 files changed, 14 insertions, 7 deletions
@@ -3,6 +3,9 @@ PHP 4.0 NEWS ?? ??? 2000, Version 4.0.4 +- Fixed a bug in session.c. The php_session_save_current_state did not check + if mod_data is NULL and such situation is possible if the user calls + session_module_name with a parameter. (alex@zend.com) - IIS Admin mudule added - OCIBindByName() now does better parameter-checking. (Thies) - Attempted to make compile fixes for Solaris in ext/sockets/sockets.c (Chris Vandomelen) diff --git a/ext/session/session.c b/ext/session/session.c index 4ab1377dbb..78cbd794cd 100644 --- a/ext/session/session.c +++ b/ext/session/session.c @@ -579,12 +579,15 @@ static void php_session_save_current_state(PSLS_D) } } - val = php_session_encode(&vallen PSLS_CC); - if (val) { - ret = PS(mod)->write(&PS(mod_data), PS(id), val, vallen); - efree(val); - } else - ret = PS(mod)->write(&PS(mod_data), PS(id), "", 0); + if (PS(mod_data)) { + val = php_session_encode(&vallen PSLS_CC); + if (val) { + ret = PS(mod)->write(&PS(mod_data), PS(id), val, vallen); + efree(val); + } else { + ret = PS(mod)->write(&PS(mod_data), PS(id), "", 0); + } + } if (ret == FAILURE) php_error(E_WARNING, "Failed to write session data (%s). Please " @@ -594,7 +597,8 @@ static void php_session_save_current_state(PSLS_D) PS(save_path)); - PS(mod)->close(&PS(mod_data)); + if (PS(mod_data)) + PS(mod)->close(&PS(mod_data)); } static char *month_names[] = { |