size_t vlen;
size_t nlen;
- while(*ptr && ISBLANK(*ptr))
+ while(ISBLANK(*ptr))
ptr++;
/* we have a <name>=<value> pair or a stand-alone word here */
nlen--;
if(*ptr == '=') {
- vlen = strcspn(++ptr, ";\r\n");
+ ptr++;
+ /* Skip spaces and tabs before the value */
+ while(ISBLANK(*ptr))
+ ptr++;
+
+ vlen = strcspn(ptr, ";\r\n");
valuep = ptr;
sep = TRUE;
ptr = &valuep[vlen];
while(vlen && ISBLANK(valuep[vlen-1]))
vlen--;
- /* Skip leading whitespace from the value */
- while(vlen && ISBLANK(*valuep)) {
- valuep++;
- vlen--;
- }
-
/* Reject cookies with a TAB inside the value */
if(memchr(valuep, '\t', vlen)) {
infof(data, "cookie contains TAB, dropping");
/* this is an "illegal" <what>=<this> pair */
}
- while(*ptr && ISBLANK(*ptr))
+ while(ISBLANK(*ptr))
ptr++;
if(*ptr == ';')
ptr++;
/* This is a cookie line, get it! */
lineptr += 11;
headerline = TRUE;
- while(*lineptr && ISBLANK(*lineptr))
+ while(ISBLANK(*lineptr))
lineptr++;
}