SIZE_MAX is an very overkill size for certificates or keys, lower it to
100KiB for both certificate and keys. The default max size of openssl is
100KiB for the entire chain [1], and it seems firefox fails at ~60kb
[2].
Found by https://github.com/curl/curl/pull/16923
[0] https://docs.openssl.org/3.2/man3/SSL_CTX_set_max_cert_list/#notes
[2] https://0x00.cl/blog/2024/exploring-tls-certs/
Closes #16951
#define DYN_MQTT_RECV (64*1024)
#define DYN_MQTT_SEND 0xFFFFFFF
#define DYN_CRLFILE_SIZE (400*1024*1024) /* 400mb */
+#define DYN_CERTFILE_SIZE (100*1024) /* 100KiB */
+#define DYN_KEYFILE_SIZE (100*1024) /* 100KiB */
#endif
return CURLE_SSL_CERTPROBLEM;
}
- Curl_dyn_init(&cert_contents, SIZE_MAX);
- Curl_dyn_init(&key_contents, SIZE_MAX);
+ Curl_dyn_init(&cert_contents, DYN_CERTFILE_SIZE);
+ Curl_dyn_init(&key_contents, DYN_KEYFILE_SIZE);
if(!read_file_into(conn_config->clientcert, &cert_contents)) {
failf(data, "rustls: failed to read client certificate file: '%s'",