andi Thu Oct 28 20:37:26 2004 EDT Modified files: /php-src/ext/standard file.c Log: - [PATCH] Bug fix for #29770, but for PHP 4.3.9 (Vladimir Zidar) http://cvs.php.net/diff.php/php-src/ext/standard/file.c?r1=1.390&r2=1.391&ty=u Index: php-src/ext/standard/file.c diff -u php-src/ext/standard/file.c:1.390 php-src/ext/standard/file.c:1.391 --- php-src/ext/standard/file.c:1.390 Tue Oct 19 18:25:15 2004 +++ php-src/ext/standard/file.c Thu Oct 28 20:37:22 2004 @@ -21,7 +21,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: file.c,v 1.390 2004/10/19 22:25:15 iliaa Exp $ */ +/* $Id: file.c,v 1.391 2004/10/29 00:37:22 andi Exp $ */ /* Synced with php 3.0 revision 1.218 1999-06-16 [ssb] */ @@ -825,7 +825,7 @@ zval **arg1, **arg2; FILE *fp; char *p, *tmp = NULL; - char *b, buf[1024]; + char *b, *buf = 0; php_stream *stream; if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE) { @@ -848,10 +848,11 @@ b = NULL; } } + if (b) { - snprintf(buf, sizeof(buf), "%s%s", PG(safe_mode_exec_dir), b); + spprintf(&buf, 0, "%s%s", PG(safe_mode_exec_dir), b); } else { - snprintf(buf, sizeof(buf), "%s/%s", PG(safe_mode_exec_dir), Z_STRVAL_PP(arg1)); + spprintf(&buf, 0, "%s/%s", PG(safe_mode_exec_dir), Z_STRVAL_PP(arg1)); } tmp = php_escape_shell_cmd(buf); @@ -861,8 +862,12 @@ if (!fp) { php_error_docref2(NULL TSRMLS_CC, buf, p, E_WARNING, "%s", strerror(errno)); efree(p); + efree(buf); RETURN_FALSE; } + + efree(buf); + } else { fp = VCWD_POPEN(Z_STRVAL_PP(arg1), p); if (!fp) {
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php