cvs: php-src(PHP_5_1) /main php_open_temporary_file.c

From: Date: Tue, 23 May 2006 23:22:27 +0000
Subject: cvs: php-src(PHP_5_1) /main php_open_temporary_file.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-38380@lists.php.net to get a copy of this message
iliaa Tue May 23 23:22:27 2006 UTC Modified files: (Branch: PHP_5_1) /php-src/main php_open_temporary_file.c 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.34.2.1&r2=1.34.2.2&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.2 --- 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:26 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.2 2006/05/23 23:22:26 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)) {

« previous php.cvs (#38380) next »