tony2001 Fri May 6 12:48:30 2005 EDT
Modified files:
/php-src/main php_open_temporary_file.c
/php-src/ext/gd gd.c
Log:
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.32&r2=1.33&ty=u
Index: php-src/main/php_open_temporary_file.c
diff -u php-src/main/php_open_temporary_file.c:1.32
php-src/main/php_open_temporary_file.c:1.33
--- php-src/main/php_open_temporary_file.c:1.32 Wed Feb 23 05:54:06 2005
+++ php-src/main/php_open_temporary_file.c Fri May 6 12:48:30 2005
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_open_temporary_file.c,v 1.32 2005/02/23 10:54:06 hyanantha Exp $ */
+/* $Id: php_open_temporary_file.c,v 1.33 2005/05/06 16:48:30 tony2001 Exp $ */
#include "php.h"
@@ -98,6 +98,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
@@ -111,11 +112,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.310&r2=1.311&ty=u
Index: php-src/ext/gd/gd.c
diff -u php-src/ext/gd/gd.c:1.310 php-src/ext/gd/gd.c:1.311
--- php-src/ext/gd/gd.c:1.310 Sun Apr 17 06:17:03 2005
+++ php-src/ext/gd/gd.c Fri May 6 12:48:30 2005
@@ -18,7 +18,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: gd.c,v 1.310 2005/04/17 10:17:03 derick Exp $ */
+/* $Id: gd.c,v 1.311 2005/05/06 16:48:30 tony2001 Exp $ */
/* gd 1.2 is copyright 1994, 1995, Quest Protein Database Center,
Cold Spring Harbor Labs. */
@@ -1778,7 +1778,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