andi Thu Oct 28 20:38:45 2004 EDT
Modified files: (Branch: PHP_4_3)
/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.279.2.64&r2=1.279.2.65&ty=u
Index: php-src/ext/standard/file.c
diff -u php-src/ext/standard/file.c:1.279.2.64 php-src/ext/standard/file.c:1.279.2.65
--- php-src/ext/standard/file.c:1.279.2.64 Thu Oct 28 01:05:57 2004
+++ php-src/ext/standard/file.c Thu Oct 28 20:38:44 2004
@@ -21,7 +21,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: file.c,v 1.279.2.64 2004/10/28 05:05:57 tony2001 Exp $ */
+/* $Id: file.c,v 1.279.2.65 2004/10/29 00:38:44 andi Exp $ */
/* Synced with php 3.0 revision 1.218 1999-06-16 [ssb] */
@@ -1189,7 +1189,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) {
@@ -1212,10 +1212,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);
@@ -1225,8 +1226,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