From 847741cb08f79676c80e7fffadc108854683f343 Mon Sep 17 00:00:00 2001 From: Ilia Alshanetsky Date: Sat, 9 Dec 2006 13:01:23 +0000 Subject: Strip leading spaces from cookie names, that can come from multi-cookie headers where ; can be followed by any number of spaces. --- main/php_variables.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'main/php_variables.c') diff --git a/main/php_variables.c b/main/php_variables.c index 789511391f..c77b939fd3 100644 --- a/main/php_variables.c +++ b/main/php_variables.c @@ -342,6 +342,17 @@ SAPI_API SAPI_TREAT_DATA_FUNC(php_default_treat_data) 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 @@ SAPI_API SAPI_TREAT_DATA_FUNC(php_default_treat_data) } efree(val); } +next_cookie: var = php_strtok_r(NULL, separator, &strtok_buf); } -- cgit v1.2.1