summaryrefslogtreecommitdiff
path: root/main/php_variables.c
diff options
context:
space:
mode:
authorIlia Alshanetsky <iliaa@php.net>2006-12-09 13:01:23 +0000
committerIlia Alshanetsky <iliaa@php.net>2006-12-09 13:01:23 +0000
commit847741cb08f79676c80e7fffadc108854683f343 (patch)
treecd729ec0592d64ff4e86f14c4db8c9b84a70755e /main/php_variables.c
parente41f103431df1b1d9b9cd2ac3711ca0655ed0451 (diff)
downloadphp-git-847741cb08f79676c80e7fffadc108854683f343.tar.gz
Strip leading spaces from cookie names, that can come from multi-cookie
headers where ; can be followed by any number of spaces.
Diffstat (limited to 'main/php_variables.c')
-rw-r--r--main/php_variables.c12
1 files changed, 12 insertions, 0 deletions
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);
}