cvs: php4 / NEWS /ext/session session.c
| From: | Alexander Feldman | Date: | Mon, 23 Oct 2000 13:10:01 +0000 |
| Subject: | cvs: php4 / NEWS /ext/session session.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-2243@lists.php.net to get a copy of this message | ||
sasha Mon Oct 23 06:10:01 2000 EDT
Modified files:
/php4 NEWS
/php4/ext/session session.c
Log:
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.
Index: php4/NEWS
diff -u php4/NEWS:1.488 php4/NEWS:1.489
--- php4/NEWS:1.488 Sun Oct 22 18:09:09 2000
+++ php4/NEWS Mon Oct 23 06:10:01 2000
@@ -3,6 +3,9 @@
?? ??? 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)
Index: php4/ext/session/session.c
diff -u php4/ext/session/session.c:1.177 php4/ext/session/session.c:1.178
--- php4/ext/session/session.c:1.177 Wed Oct 11 12:47:15 2000
+++ php4/ext/session/session.c Mon Oct 23 06:10:01 2000
@@ -579,12 +579,15 @@
}
}
- 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 @@
PS(save_path));
- PS(mod)->close(&PS(mod_data));
+ if (PS(mod_data))
+ PS(mod)->close(&PS(mod_data));
}
static char *month_names[] = {