-
-
Notifications
You must be signed in to change notification settings - Fork 7k
rustls: precaution for possible malicious certs_num from peer #19397
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
Conversation
|
The backend |
0b315a1 to
0f7fe69
Compare
This comment was marked as outdated.
This comment was marked as outdated.
I made an attempt. If anything is improper, I will reset the changes for them. wolfSSL_CTX_load_verify_buffer() have a buffer size limitation already. By the way, I add a precaution check for preventing invalid socket for wolfssl. For mbedtls, it sets the verification callback via mbedtls_ssl_conf_verify(). Our local function is |
|
Thanks! |
This PR does a precaution for possible malicious certs_num from peer. By doing so, we do not need to worry about the possible issues of the cast for
num_certs, or malicious servers which send abnomal number of certs.Note that
MAX_ALLOWED_CERT_AMOUNTis based on the code of https://github.com/curl/curl/blob/master/lib/vtls/openssl.c#L352.The handling is also a copy of code from openssl.c:
Other:
The type of the second parameter of rustls_connection_get_peer_certificate is
size_t, so we do not need to cast thenum_certstointthere, just like the calling at line 1232(cert = rustls_connection_get_peer_certificate(rconn, i);).