mirror of
https://github.com/owasp-modsecurity/ModSecurity.git
synced 2025-09-30 03:34:29 +03:00
Fix Cookie header parsing issues
This commit is contained in:
committed by
Felipe Zimmerle
parent
7ba77631f9
commit
b8160cce6b
@@ -549,7 +549,18 @@ int Transaction::addRequestHeader(const std::string& key,
|
||||
if (keyl == "cookie") {
|
||||
size_t localOffset = m_variableOffset;
|
||||
size_t pos;
|
||||
|
||||
std::vector<std::string> cookies = utils::string::ssplit(value, ';');
|
||||
|
||||
// Get rid of any optional whitespace after the cookie-string
|
||||
// (i.e. after the end of the final cookie-pair)
|
||||
if (!cookies.empty()) {
|
||||
std::string& final_cookie_pair = cookies.back();
|
||||
while (!final_cookie_pair.empty() && isspace(final_cookie_pair.back())) {
|
||||
final_cookie_pair.pop_back();
|
||||
}
|
||||
}
|
||||
|
||||
for (const std::string &c : cookies) {
|
||||
// skip empty substring, eg "Cookie: ;;foo=bar"
|
||||
if (c.empty() == true) {
|
||||
|
Reference in New Issue
Block a user