cvs: /php4/ext/standard file.c
| From: | Thies C. Arntzen | Date: | Thu, 06 Jan 2000 15:27:33 +0000 |
| Subject: | cvs: /php4/ext/standard file.c | ||
| Groups: | php.version4 | ||
| Request: | Send a blank email to php-version4+get-8962@lists.php.net to get a copy of this message | ||
thies Thu Jan 6 10:27:33 2000 EDT
Modified files:
/php4/ext/standard file.c
Log:
@- Applied safe-mode patch to popen(). (Patch by Kristian Köhntopp)
Index: php4/ext/standard/file.c
diff -u php4/ext/standard/file.c:1.55 php4/ext/standard/file.c:1.56
--- php4/ext/standard/file.c:1.55 Fri Dec 31 20:31:51 1999
+++ php4/ext/standard/file.c Thu Jan 6 10:27:03 2000
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: file.c,v 1.55 2000/01/01 01:31:51 sas Exp $ */
+/* $Id: file.c,v 1.56 2000/01/06 15:27:03 thies Exp $ */
/* Synced with php 3.0 revision 1.218 1999-06-16 [ssb] */
@@ -26,6 +26,7 @@
#include "php.h"
#include "php_globals.h"
#include "ext/standard/flock_compat.h"
+#include "ext/standard/exec.h"
#include <stdio.h>
#include <stdlib.h>
@@ -712,7 +713,7 @@
{
pval **arg1, **arg2;
FILE *fp;
- char *p;
+ char *p,*tmp = NULL;
char *b, buf[1024];
PLS_FETCH();
@@ -741,7 +742,11 @@
} else {
snprintf(buf,sizeof(buf),"%s/%s",PG(safe_mode_exec_dir),(*arg1)->value.str.val);
}
- fp = popen(buf,p);
+
+ tmp = php_escape_shell_cmd(buf);
+ fp = popen(tmp,p);
+ efree(tmp);
+
if (!fp) {
php_error(E_WARNING,"popen(\"%s\",\"%s\") -
%s",buf,p,strerror(errno));
RETURN_FALSE;