Skip to content

Aligned Cookie parsing method to ModSecurity2 style #2023

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions src/transaction.cc
Original file line number Diff line number Diff line change
Expand Up @@ -571,6 +571,14 @@ int Transaction::addRequestHeader(const std::string& key,
m_variableRequestCookies.set(s[0], s[1], localOffset);
localOffset = localOffset + s[1].size() + 2;
}
else {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we want to check if it is bigger than 0. Just to avoid a memory access violation.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But if we checked pos1 > 0, then what if the Cookie header starts with '='?

Should be check pos >= 0?

if (s[0].at(0) == ' ') {
s[0].erase(0, 1);
}
m_variableRequestCookiesNames.set(s[0],
s[0], localOffset);
m_variableRequestCookies.set(s[0], "", localOffset);
}
}
}
/**
Expand Down