iliaa Wed Sep 28 18:39:54 2005 EDT
Modified files: (Branch: PHP_5_1)
/php-src/main php_variables.c
/php-src/ext/standard string.c
/php-src NEWS
Log:
MFH: Fixed possible GLOBALS variable override when register_globals are ON.
MFH: Fixed possible register_globals toggle via parse_str().
MFH: Fixed negative offset handling in substr_compare() function.
http://cvs.php.net/diff.php/php-src/main/php_variables.c?r1=1.104.2.2&r2=1.104.2.3&ty=u
Index: php-src/main/php_variables.c
diff -u php-src/main/php_variables.c:1.104.2.2
php-src/main/php_variables.c:1.104.2.3
--- php-src/main/php_variables.c:1.104.2.2 Thu Sep 1 15:15:19 2005
+++ php-src/main/php_variables.c Wed Sep 28 18:39:52 2005
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_variables.c,v 1.104.2.2 2005/09/01 19:15:19 iliaa Exp $ */
+/* $Id: php_variables.c,v 1.104.2.3 2005/09/28 22:39:52 iliaa Exp $ */
#include <stdio.h>
#include "php.h"
@@ -99,6 +99,13 @@
zval_dtor(val);
return;
}
+
+ /* GLOBALS hijack attempt, reject parameter */
+ if (symtable1 == EG(active_symbol_table) && !strcmp("GLOBALS", var)) {
+ zval_dtor(val);
+ return;
+ }
+
/* ensure that we don't have spaces or dots in the variable name (not
binary safe) */
for (p=var; *p; p++) {
switch (*p) {
http://cvs.php.net/diff.php/php-src/ext/standard/string.c?r1=1.445&r2=1.445.2.1&ty=u
Index: php-src/ext/standard/string.c
diff -u php-src/ext/standard/string.c:1.445
php-src/ext/standard/string.c:1.445.2.1
--- php-src/ext/standard/string.c:1.445 Wed Aug 3 10:08:13 2005
+++ php-src/ext/standard/string.c Wed Sep 28 18:39:52 2005
@@ -18,7 +18,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: string.c,v 1.445 2005/08/03 14:08:13 sniper Exp $ */
+/* $Id: string.c,v 1.445.2.1 2005/09/28 22:39:52 iliaa Exp $ */
/* Synced with php 3.0 revision 1.193 1999-06-16 [ssb] */
@@ -3857,7 +3857,6 @@
zval *sarg;
char *res = NULL;
int argCount;
- int old_rg;
argCount = ZEND_NUM_ARGS();
if (argCount < 1 || argCount > 2 || zend_get_parameters_ex(argCount,
&arg, &arrayArg) == FAILURE) {
@@ -3870,19 +3869,18 @@
res = estrndup(Z_STRVAL_P(sarg), Z_STRLEN_P(sarg));
}
- old_rg = PG(register_globals);
if (argCount == 1) {
- PG(register_globals) = 1;
- sapi_module.treat_data(PARSE_STRING, res, NULL TSRMLS_CC);
+ zval tmp;
+ Z_ARRVAL(tmp) = EG(active_symbol_table);
+
+ sapi_module.treat_data(PARSE_STRING, res, &tmp TSRMLS_CC);
} else {
- PG(register_globals) = 0;
/* Clear out the array that was passed in. */
zval_dtor(*arrayArg);
array_init(*arrayArg);
sapi_module.treat_data(PARSE_STRING, res, *arrayArg TSRMLS_CC);
}
- PG(register_globals) = old_rg;
}
/* }}} */
@@ -4883,6 +4881,10 @@
RETURN_FALSE;
}
+ if (offset < 0) {
+ offset = s1_len + offset;
+ }
+
cmp_len = (uint) (len ? len : MAX(s2_len, (s1_len - offset)));
if (!cs) {
http://cvs.php.net/diff.php/php-src/NEWS?r1=1.2027.2.83&r2=1.2027.2.84&ty=u
Index: php-src/NEWS
diff -u php-src/NEWS:1.2027.2.83 php-src/NEWS:1.2027.2.84
--- php-src/NEWS:1.2027.2.83 Wed Sep 28 07:24:17 2005
+++ php-src/NEWS Wed Sep 28 18:39:52 2005
@@ -1,6 +1,9 @@
PHP NEWS
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
?? Aug 2005, PHP 5.1 Release Candidate 2
+- Fixed possible GLOBALS variable override when register_globals are ON.
+ (Ilia, Stefan)
+- Fixed possible register_globals toggle via parse_str(). (Ilia, Stefan)
- Changed SQLite extension to be a shared module in Windows distribution.
(Edin)
- Changed "instanceof" and "catch" operators, is_a() and is_subclass_of()
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php