tony2001 Fri May 6 12:49:04 2005 EDT
Modified files: (Branch: PHP_5_0)
/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.30.2.1&r2=1.30.2.2&ty=u
Index: php-src/main/php_open_temporary_file.c
diff -u php-src/main/php_open_temporary_file.c:1.30.2.1
php-src/main/php_open_temporary_file.c:1.30.2.2
--- php-src/main/php_open_temporary_file.c:1.30.2.1 Fri Mar 11 03:18:14 2005
+++ php-src/main/php_open_temporary_file.c Fri May 6 12:49:04 2005
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_open_temporary_file.c,v 1.30.2.1 2005/03/11 08:18:14 hyanantha Exp
$ */
+/* $Id: php_open_temporary_file.c,v 1.30.2.2 2005/05/06 16:49:04 tony2001 Exp
$ */
#include "php.h"
@@ -104,6 +104,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
@@ -120,11 +121,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.294.2.11&r2=1.294.2.12&ty=u
Index: php-src/ext/gd/gd.c
diff -u php-src/ext/gd/gd.c:1.294.2.11 php-src/ext/gd/gd.c:1.294.2.12
--- php-src/ext/gd/gd.c:1.294.2.11 Mon Jan 17 12:07:47 2005
+++ php-src/ext/gd/gd.c Fri May 6 12:49:04 2005
@@ -18,7 +18,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: gd.c,v 1.294.2.11 2005/01/17 17:07:47 sniper Exp $ */
+/* $Id: gd.c,v 1.294.2.12 2005/05/06 16:49:04 tony2001 Exp $ */
/* gd 1.2 is copyright 1994, 1995, Quest Protein Database Center,
Cold Spring Harbor Labs. */
@@ -1781,7 +1781,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