8335b1
--- a/modules/loggers/mod_log_config.c	2013/11/15 17:07:52	1542329
8335b1
+++ b/modules/loggers/mod_log_config.c	2014/03/10 11:23:47	1575904
8335b1
@@ -543,14 +543,24 @@
8335b1
 
8335b1
         while ((cookie = apr_strtok(cookies, ";", &last1))) {
8335b1
             char *name = apr_strtok(cookie, "=", &last2);
8335b1
-            if (name) {
8335b1
-                char *value = name + strlen(name) + 1;
8335b1
-                apr_collapse_spaces(name, name);
8335b1
+            /* last2 points to the next char following an '=' delim,
8335b1
+               or the trailing NUL char of the string */
8335b1
+            char *value = last2;
8335b1
+            if (name && *name &&  value && *value) {
8335b1
+                char *last = value - 2;
8335b1
+                /* Move past leading WS */
8335b1
+                name += strspn(name, " \t");
8335b1
+                while (last >= name && apr_isspace(*last)) {
8335b1
+                    *last = '\0';
8335b1
+                    --last;
8335b1
+                }
8335b1
 
8335b1
                 if (!strcasecmp(name, a)) {
8335b1
-                    char *last;
8335b1
-                    value += strspn(value, " \t");  /* Move past leading WS */
8335b1
-                    last = value + strlen(value) - 1;
8335b1
+                    /* last1 points to the next char following the ';' delim,
8335b1
+                       or the trailing NUL char of the string */
8335b1
+                    last = last1 - (*last1 ? 2 : 1);
8335b1
+                    /* Move past leading WS */
8335b1
+                    value += strspn(value, " \t");
8335b1
                     while (last >= value && apr_isspace(*last)) {
8335b1
                        *last = '\0';
8335b1
                        --last;
8335b1
@@ -559,6 +569,7 @@
8335b1
                     return ap_escape_logitem(r->pool, value);
8335b1
                 }
8335b1
             }
8335b1
+            /* Iterate the remaining tokens using apr_strtok(NULL, ...) */
8335b1
             cookies = NULL;
8335b1
         }
8335b1
     }