iliaa           Tue May 23 23:22:16 2006 UTC

  Modified files:              
    /php-src/main       php_open_temporary_file.c 
  Log:
  MFB: 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.35&r2=1.36&diff_format=u
Index: php-src/main/php_open_temporary_file.c
diff -u php-src/main/php_open_temporary_file.c:1.35 
php-src/main/php_open_temporary_file.c:1.36
--- php-src/main/php_open_temporary_file.c:1.35 Sun Jan  1 13:09:57 2006
+++ php-src/main/php_open_temporary_file.c      Tue May 23 23:22:16 2006
@@ -16,7 +16,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: php_open_temporary_file.c,v 1.35 2006/01/01 13:09:57 sniper Exp $ */
+/* $Id: php_open_temporary_file.c,v 1.36 2006/05/23 23:22:16 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)) {

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

Reply via email to