[prev in list] [next in list] [prev in thread] [next in thread] 

List:       php-cvs
Subject:    [PHP-CVS] cvs: php-src(PHP_5_0) /ext/standard file.c
From:       "Andi Gutmans" <andi () php ! net>
Date:       2004-10-29 0:37:52
Message-ID: cvsandi1099010272 () cvsserver
[Download RAW message or body]

andi		Thu Oct 28 20:37:52 2004 EDT

  Modified files:              (Branch: PHP_5_0)
    /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.382.2.1&r2=1.382.2.2&ty=u
Index: php-src/ext/standard/file.c
diff -u php-src/ext/standard/file.c:1.382.2.1 php-src/ext/standard/file.c:1.382.2.2
--- php-src/ext/standard/file.c:1.382.2.1	Thu Sep  9 15:41:40 2004
+++ php-src/ext/standard/file.c	Thu Oct 28 20:37:51 2004
@@ -21,7 +21,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: file.c,v 1.382.2.1 2004/09/09 19:41:40 wez Exp $ */
+/* $Id: file.c,v 1.382.2.2 2004/10/29 00:37:51 andi Exp $ */
 
 /* Synced with php 3.0 revision 1.218 1999-06-16 [ssb] */
 
@@ -803,7 +803,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) {
@@ -826,10 +826,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);
@@ -839,8 +840,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

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic