tony2001 Fri May 6 12:51:55 2005 EDT Modified files: (Branch: PHP_4_3) /php-src/main php_open_temporary_file.c /php-src/ext/gd gd.c Log: MFH: fix off-by-one in _php_image_output() and prevent such errors in php_do_open_temporary_file() http://cvs.php.net/diff.php/php-src/main/php_open_temporary_file.c?r1=1.18.2.9&r2=1.18.2.10&ty=u Index: php-src/main/php_open_temporary_file.c diff -u php-src/main/php_open_temporary_file.c:1.18.2.9 php-src/main/php_open_temporary_file.c:1.18.2.10 --- php-src/main/php_open_temporary_file.c:1.18.2.9 Mon Mar 29 16:28:47 2004 +++ php-src/main/php_open_temporary_file.c Fri May 6 12:51:54 2005 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_open_temporary_file.c,v 1.18.2.9 2004/03/29 21:28:47 wez Exp $ */ +/* $Id: php_open_temporary_file.c,v 1.18.2.10 2005/05/06 16:51:54 tony2001 Exp $ */ #include "php.h" @@ -106,6 +106,7 @@ { char *trailing_slash; char *opened_path; + int path_len = 0; int fd = -1; #ifndef HAVE_MKSTEMP int open_flags = O_CREAT | O_TRUNC | O_RDWR @@ -122,11 +123,13 @@ return -1; } + path_len = strlen(path); + if (!(opened_path = emalloc(MAXPATHLEN))) { return -1; } - if (IS_SLASH(path[strlen(path)-1])) { + if (!path_len || IS_SLASH(path[path_len - 1])) { trailing_slash = ""; } else { trailing_slash = "/"; http://cvs.php.net/diff.php/php-src/ext/gd/gd.c?r1=1.221.2.55&r2=1.221.2.56&ty=u Index: php-src/ext/gd/gd.c diff -u php-src/ext/gd/gd.c:1.221.2.55 php-src/ext/gd/gd.c:1.221.2.56 --- php-src/ext/gd/gd.c:1.221.2.55 Mon May 2 05:39:26 2005 +++ php-src/ext/gd/gd.c Fri May 6 12:51:54 2005 @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: gd.c,v 1.221.2.55 2005/05/02 09:39:26 pajoye Exp $ */ +/* $Id: gd.c,v 1.221.2.56 2005/05/06 16:51:54 tony2001 Exp $ */ /* gd 1.2 is copyright 1994, 1995, Quest Protein Database Center, Cold Spring Harbor Labs. */ @@ -1699,7 +1699,7 @@ char buf[4096]; char *path; - tmp = php_open_temporary_file("", "", &path TSRMLS_CC); + tmp = php_open_temporary_file(NULL, NULL, &path TSRMLS_CC); if (tmp == NULL) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to open temporary file"); RETURN_FALSE;
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php