Skip to content
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

ssl: first pass limit when allocating buffer for certificates #7131

Closed
Closed
Changes from all commits
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
4 changes: 4 additions & 0 deletions src/app-layer-ssl.c
Original file line number Diff line number Diff line change
Expand Up @@ -1431,6 +1431,10 @@ static int EnsureRecordSpace(SSLStateConnp *curr_connp, const uint8_t * const in
SCLogDebug("cert_len unknown still, create small buffer to start");
certs_len = 256;
}
// Limit in a first time allocation for very large certificates
if (certs_len > 0x10000 && certs_len > curr_connp->trec_pos + input_len) {
Copy link
Member

Choose a reason for hiding this comment

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

should we first check if current input will set the limited value?

Also please use a macro with a clear name, a decimal value and a comment to explain the default

Copy link
Contributor Author

Choose a reason for hiding this comment

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

should we first check if current input will set the limited value?

I am not sure I understand your question.
This is a first check that current input will set the limited value...

That is if not certs_len > curr_connp->trec_pos + input_len that means that the current input will cross the 65k boundary, and thus, we do not limit ourselves

certs_len = 0x10000;
}

if (curr_connp->trec == NULL) {
curr_connp->trec_len = certs_len;
Expand Down