iliaa           Tue May 23 23:23:40 2006 UTC

  Modified files:              (Branch: PHP_4_4)
    /php-src/main       php_open_temporary_file.c 
    /php-src    NEWS 
  Log:
  MFH: 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.18.2.10.2.2&r2=1.18.2.10.2.3&diff_format=u
Index: php-src/main/php_open_temporary_file.c
diff -u php-src/main/php_open_temporary_file.c:1.18.2.10.2.2 
php-src/main/php_open_temporary_file.c:1.18.2.10.2.3
--- php-src/main/php_open_temporary_file.c:1.18.2.10.2.2        Sun Jan  1 
13:46:59 2006
+++ php-src/main/php_open_temporary_file.c      Tue May 23 23:23:39 2006
@@ -16,7 +16,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: php_open_temporary_file.c,v 1.18.2.10.2.2 2006/01/01 13:46:59 sniper 
Exp $ */
+/* $Id: php_open_temporary_file.c,v 1.18.2.10.2.3 2006/05/23 23:23:39 iliaa 
Exp $ */
 
 #include "php.h"
 
@@ -115,17 +115,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.1247.2.920.2.133&r2=1.1247.2.920.2.134&diff_format=u
Index: php-src/NEWS
diff -u php-src/NEWS:1.1247.2.920.2.133 php-src/NEWS:1.1247.2.920.2.134
--- php-src/NEWS:1.1247.2.920.2.133     Sun May 21 17:26:13 2006
+++ php-src/NEWS        Tue May 23 23:23:40 2006
@@ -1,6 +1,7 @@
 PHP 4                                                                      NEWS
 |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
 ?? ??? 2006, Version 4.4.3
+- Fixed handling of extremely long paths inside tempnam() function. (Ilia)
 
 21 May 2006, Version 4.4.3RC1
 - Added control character checks for cURL extension's open_basedir/safe_mode

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

Reply via email to