iliaa           Tue Apr 13 14:18:23 2004 EDT

  Modified files:              
    /php-src/ext/session        session.c 
  Log:
  Another setting leak in session code (bug #27963).
  
  
http://cvs.php.net/diff.php/php-src/ext/session/session.c?r1=1.388&r2=1.389&ty=u
Index: php-src/ext/session/session.c
diff -u php-src/ext/session/session.c:1.388 php-src/ext/session/session.c:1.389
--- php-src/ext/session/session.c:1.388 Mon Apr 12 20:39:05 2004
+++ php-src/ext/session/session.c       Tue Apr 13 14:18:22 2004
@@ -17,7 +17,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: session.c,v 1.388 2004/04/13 00:39:05 iliaa Exp $ */
+/* $Id: session.c,v 1.389 2004/04/13 18:18:22 iliaa Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -1285,32 +1285,28 @@
 {
        zval **p_name;
        int ac = ZEND_NUM_ARGS();
-       char *old;
 
        if (ac < 0 || ac > 1 || zend_get_parameters_ex(ac, &p_name) == FAILURE)
                WRONG_PARAM_COUNT;
-       
-       old = safe_estrdup(PS(mod)->s_name);
 
        if (ac == 1) {
-               ps_module *tempmod;
-
                convert_to_string_ex(p_name);
-               tempmod = _php_find_ps_module(Z_STRVAL_PP(p_name) TSRMLS_CC);
-               if (tempmod) {
-                       if (PS(mod_data))
-                               PS(mod)->s_close(&PS(mod_data) TSRMLS_CC);
-                       PS(mod) = tempmod;
-                       PS(mod_data) = NULL;
-               } else {
-                       efree(old);
+               if (!_php_find_ps_module(Z_STRVAL_PP(p_name) TSRMLS_CC)) {
                        php_error_docref(NULL TSRMLS_CC, E_ERROR, "Cannot find named 
PHP session module (%s)",
                                        Z_STRVAL_PP(p_name));
                        RETURN_FALSE;
                }
-       }
+               if (PS(mod_data)) {
+                       PS(mod)->s_close(&PS(mod_data) TSRMLS_CC);
+               }
+               PS(mod_data) = NULL;
 
-       RETVAL_STRING(old, 0);
+               RETVAL_STRING(safe_estrdup(PS(mod)->s_name), 0);
+
+               zend_alter_ini_entry("session.save_handler", 
sizeof("session.save_handler"), Z_STRVAL_PP(p_name), Z_STRLEN_PP(p_name), 
PHP_INI_USER, PHP_INI_STAGE_RUNTIME);
+       } else {
+               RETURN_STRING(safe_estrdup(PS(mod)->s_name), 0);
+       }
 }
 /* }}} */
 

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to