cvs: php-src /sapi/cgi cgi_main.c
| From: | Dmitry Stogov | Date: | Wed, 15 Nov 2006 11:14:27 +0000 |
| Subject: | cvs: php-src /sapi/cgi cgi_main.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-41572@lists.php.net to get a copy of this message | ||
dmitry Wed Nov 15 11:14:27 2006 UTC
Modified files:
/php-src/sapi/cgi cgi_main.c
Log:
Fixed wrong ext/filter behavior. It might not to register FastCGI environment variables and make
memory leaks.
http://cvs.php.net/viewvc.cgi/php-src/sapi/cgi/cgi_main.c?r1=1.303&r2=1.304&diff_format=u
Index: php-src/sapi/cgi/cgi_main.c
diff -u php-src/sapi/cgi/cgi_main.c:1.303 php-src/sapi/cgi/cgi_main.c:1.304
--- php-src/sapi/cgi/cgi_main.c:1.303 Tue Nov 14 10:32:11 2006
+++ php-src/sapi/cgi/cgi_main.c Wed Nov 15 11:14:27 2006
@@ -21,7 +21,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: cgi_main.c,v 1.303 2006/11/14 10:32:11 dmitry Exp $ */
+/* $Id: cgi_main.c,v 1.304 2006/11/15 11:14:27 dmitry Exp $ */
#include "php.h"
#include "php_globals.h"
@@ -476,13 +476,14 @@
uint var_len;
char **val;
ulong idx;
+ int filter_arg = (array_ptr == PG(http_globals)[TRACK_VARS_ENV])?PARSE_ENV:PARSE_SERVER;
for (zend_hash_internal_pointer_reset_ex(&request->env, &pos);
zend_hash_get_current_key_ex(&request->env, &var, &var_len, &idx, 0,
&pos) == HASH_KEY_IS_STRING &&
zend_hash_get_current_data_ex(&request->env, (void **) &val, &pos) ==
SUCCESS;
zend_hash_move_forward_ex(&request->env, &pos)) {
- int new_val_len;
- if (sapi_module.input_filter(PARSE_SERVER, var.s, val, strlen(*val), &new_val_len
TSRMLS_CC)) {
+ unsigned int new_val_len;
+ if (sapi_module.input_filter(filter_arg, var.s, val, strlen(*val), &new_val_len TSRMLS_CC))
{
php_register_variable_safe(var.s, *val, new_val_len, array_ptr TSRMLS_CC);
}
}
@@ -491,7 +492,7 @@
static void sapi_cgi_register_variables(zval *track_vars_array TSRMLS_DC)
{
- int new_val_len;
+ unsigned int new_val_len;
char *val = SG(request_info).request_uri ? SG(request_info).request_uri : "";
/* In CGI mode, we consider the environment to be a part of the server
* variables