iliaa           Tue May 23 23:22:04 2006 UTC

  Modified files:              (Branch: PHP_5_2)
    /php-src/main       php_open_temporary_file.c 
    /php-src    NEWS 
  Log:
  Fixed handling of extremely long paths inside tempnam() function.
  
  
http://cvs.php.net/viewcvs.cgi/php-src/main/php_open_temporary_file.c?r1=1.34.2.1&r2=1.34.2.1.2.1&diff_format=u
Index: php-src/main/php_open_temporary_file.c
diff -u php-src/main/php_open_temporary_file.c:1.34.2.1 
php-src/main/php_open_temporary_file.c:1.34.2.1.2.1
--- php-src/main/php_open_temporary_file.c:1.34.2.1     Sun Jan  1 12:50:17 2006
+++ php-src/main/php_open_temporary_file.c      Tue May 23 23:22:04 2006
@@ -16,7 +16,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: php_open_temporary_file.c,v 1.34.2.1 2006/01/01 12:50:17 sniper Exp $ 
*/
+/* $Id: php_open_temporary_file.c,v 1.34.2.1.2.1 2006/05/23 23:22:04 iliaa Exp 
$ */
 
 #include "php.h"
 
@@ -114,17 +114,16 @@
 
        path_len = strlen(path);
 
-       if (!(opened_path = emalloc(MAXPATHLEN))) {
-               return -1;
-       }
-
        if (!path_len || IS_SLASH(path[path_len - 1])) {
                trailing_slash = "";
        } else {
                trailing_slash = "/";
        }
 
-       (void)snprintf(opened_path, MAXPATHLEN, "%s%s%sXXXXXX", path, 
trailing_slash, pfx);
+       if (spprintf(&opened_path, 0, "%s%s%sXXXXXX", path, trailing_slash, 
pfx) >= MAXPATHLEN) {
+               efree(opened_path);
+               return -1;
+       }
 
 #ifdef PHP_WIN32
        if (GetTempFileName(path, pfx, 0, opened_path)) {
http://cvs.php.net/viewcvs.cgi/php-src/NEWS?r1=1.2027.2.547.2.40&r2=1.2027.2.547.2.41&diff_format=u
Index: php-src/NEWS
diff -u php-src/NEWS:1.2027.2.547.2.40 php-src/NEWS:1.2027.2.547.2.41
--- php-src/NEWS:1.2027.2.547.2.40      Tue May 23 21:58:44 2006
+++ php-src/NEWS        Tue May 23 23:22:04 2006
@@ -1,6 +1,7 @@
 PHP                                                                        NEWS
 |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
 ?? ??? 2006, PHP 5.2.0
+- Fixed handling of extremely long paths inside tempnam() function. (Ilia)
 - Added control character checks for cURL extension's open_basedir/safe_mode
   checks. (Ilia)
 - Disable realpath cache when open_basedir or safe_mode are enabled on a 

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

Reply via email to