pollita         Fri Jul 16 01:08:16 2004 EDT

  Modified files:              (Branch: PHP_4_3)
    /php-src/ext/standard       filestat.c 
    /php-src    NEWS 
  Log:
  Bugfix# 29114  Potential double free in php_stat
  
http://cvs.php.net/diff.php/php-src/ext/standard/filestat.c?r1=1.112.2.9&r2=1.112.2.10&ty=u
Index: php-src/ext/standard/filestat.c
diff -u php-src/ext/standard/filestat.c:1.112.2.9 
php-src/ext/standard/filestat.c:1.112.2.10
--- php-src/ext/standard/filestat.c:1.112.2.9   Mon Sep  1 21:23:21 2003
+++ php-src/ext/standard/filestat.c     Fri Jul 16 01:08:15 2004
@@ -16,7 +16,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: filestat.c,v 1.112.2.9 2003/09/02 01:23:21 sniper Exp $ */
+/* $Id: filestat.c,v 1.112.2.10 2004/07/16 05:08:15 pollita Exp $ */
 
 #include "php.h"
 #include "safe_mode.h"
@@ -613,8 +613,11 @@
                        if (!IS_LINK_OPERATION(type) && (!IS_EXISTS_CHECK(type) || 
(errno != ENOENT && errno != ENOTDIR))) { /* fileexists() test must print no error */
                                php_error_docref(NULL TSRMLS_CC, E_WARNING, "Stat 
failed for %s (errno=%d - %s)", BG(CurrentStatFile), errno, strerror(errno));
                        }
-                       efree(BG(CurrentStatFile));
-                       BG(CurrentStatFile) = NULL;
+                       /* This could be null if a failed stat leads to a user error 
handler which calls a failed stat */
+                       if (BG(CurrentStatFile)) {
+                               efree(BG(CurrentStatFile));
+                               BG(CurrentStatFile) = NULL;
+                       }
 #if HAVE_SYMLINK
                        if (!IS_LINK_OPERATION(type))  /* Don't require success for 
link operation */
 #endif
http://cvs.php.net/diff.php/php-src/NEWS?r1=1.1247.2.702&r2=1.1247.2.703&ty=u
Index: php-src/NEWS
diff -u php-src/NEWS:1.1247.2.702 php-src/NEWS:1.1247.2.703
--- php-src/NEWS:1.1247.2.702   Thu Jul 15 22:24:45 2004
+++ php-src/NEWS        Fri Jul 16 01:08:15 2004
@@ -6,7 +6,8 @@
   for doing performance stats without warnings in server-log. (Uwe Schindler)
 - Fixed bug #29116 (Zend constant warning uses memory after free). (Marcus,
   jdolecek at NetBSD dot org)
-- Fixed Bug #29075 (strnatcmp() incorrectly handles whitespace). (Curt, Ilia)
+- Fixed bug #29114 (Potential double free in php_stat). (Sara)
+- Fixed bug #29075 (strnatcmp() incorrectly handles whitespace). (Curt, Ilia)
 - Fixed bug #29049 (array sorting via user function/method does not validate 
   it). (Ilia)
 - Fixed bug #29038 (extract() with EXTR_PREFIX_SAME prefixes empty strings).

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

Reply via email to