|
|||||||||||
|
DO NOT REPLY [Bug 16661] New: - use of strstr() in spot_cookie() mis-identifies cookies in other cookie names or cookie values
From: <bugzilla(at)apache.org>
Date: Fri Jan 31 2003 - 19:19:30 EST
use of strstr() in spot_cookie() mis-identifies cookies in other cookie names or cookie values
Summary: use of strstr() in spot_cookie() mis-identifies cookies
in other cookie names or cookie values
Product: Apache httpd-1.3
Version: 1.3.27
Platform: Other
URL:
http://www.manniwood.net/mod_usertrack_patch.html
OS/Version: Other
Status: NEW
Severity: Normal
Priority: Other
Component: Other mods
AssignedTo: bugs@httpd.apache.org
ReportedBy: manniwood@planet-save.com
Example: If you have CookieName set to "ID", then use of strstr() in spot_cookie() mod_usertrack.c will get false positives on the following sorts of cookies: "MyID=binky", "MyCookie=IDExpired". This follows up bugs 11998, 8906, 8048, 5811, and probably others. This bug keeps getting submitted. Here is a patch that has been thoroughly tested (more details at http://www.manniwood.net/mod_usertrack_patch.html):
/* Define this to allow post-2000 cookies. Cookies use two-digit dates,
@@ -250,31 +252,44 @@
cookie_dir_rec *dcfg = ap_get_module_config(r->per_dir_config,
&usertrack_module);
- const char *cookie; - char *value; + const char *cookie_header; ++ regmatch_t regm[3]; + int i;
if (!dcfg->enabled) {
return DECLINED;
}
- if ((cookie = ap_table_get(r->headers_in,
- (dcfg->style == CT_COOKIE2
- ? "Cookie2"
- : "Cookie"))))
- if ((value = strstr(cookie, dcfg->cookie_name))) {
- char *cookiebuf, *cookieend;
-
- value += strlen(dcfg->cookie_name) + 1; /* Skip over the '=' */
- cookiebuf = ap_pstrdup(r->pool, value);
- cookieend = strchr(cookiebuf, ';');
- if (cookieend)
- *cookieend = '\0'; /* Ignore anything after a ; */
-
- /* Set the cookie in a note, for logging */
- ap_table_setn(r->notes, "cookie", cookiebuf);
}
@@ -382,7 +397,20 @@ { cookie_dir_rec *dcfg = (cookie_dir_rec *) mconfig; + /* The goal is to end up with this regexp,
dcfg->cookie_name = ap_pstrdup(cmd->pool, name); + + dcfg->regexp = ap_pregcomp(cmd->pool, dcfg->regexp_string, REG_EXTENDED); + if (dcfg->regexp == NULL) { + return "Regular expression could not be compiled."; + } +
return NULL;
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org For additional commands, e-mail: bugs-help@httpd.apache.org Received on Sat Feb 01 00:17:56 2003 This archive was generated by hypermail 2.1.8 : Wed Aug 23 2006 - 16:44:21 EDT |
||||||||||
|
|||||||||||