iliaa Sat Dec 9 13:01:23 2006 UTC
Modified files: (Branch: PHP_5_2)
/php-src/main php_variables.c
Log:
Strip leading spaces from cookie names, that can come from multi-cookie
headers where ; can be followed by any number of spaces.
http://cvs.php.net/viewvc.cgi/php-src/main/php_variables.c?r1=1.104.2.10.2.1&r2=1.104.2.10.2.2&diff_format=u
Index: php-src/main/php_variables.c
diff -u php-src/main/php_variables.c:1.104.2.10.2.1
php-src/main/php_variables.c:1.104.2.10.2.2
--- php-src/main/php_variables.c:1.104.2.10.2.1 Thu Jul 27 15:37:56 2006
+++ php-src/main/php_variables.c Sat Dec 9 13:01:23 2006
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_variables.c,v 1.104.2.10.2.1 2006/07/27 15:37:56 iliaa Exp $ */
+/* $Id: php_variables.c,v 1.104.2.10.2.2 2006/12/09 13:01:23 iliaa Exp $ */
#include <stdio.h>
#include "php.h"
@@ -342,6 +342,17 @@
while (var) {
val = strchr(var, '=');
+
+ if (arg == PARSE_COOKIE) {
+ /* Remove leading spaces from cookie names, needed for
multi-cookie header where ; can be followed by a space */
+ while (isspace(*var)) {
+ var++;
+ }
+ if (var == val || *var == '\0') {
+ goto next_cookie;
+ }
+ }
+
if (val) { /* have a value */
int val_len;
unsigned int new_val_len;
@@ -366,6 +377,7 @@
}
efree(val);
}
+next_cookie:
var = php_strtok_r(NULL, separator, &strtok_buf);
}
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php