rustls: cap maximum allowed CRL file size to 8MB

Allowing 4GB on a 32-bit system is just asking for problems and could in
theory cause integer overflow in the dynbuf code.

The dynbuf now has an assert to catch code trying to set a max larger
than half SIZE_T_MAX.

Reported-by: Rinku Das
Closes #16716
This commit is contained in:
Daniel Stenberg 2025-03-14 08:28:02 +01:00
parent 27e07b2943
commit 116f490c81
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2
3 changed files with 5 additions and 1 deletions

View file

@ -81,6 +81,8 @@ int Curl_dyn_vprintf(struct dynbuf *dyn, const char *format, va_list ap_save);
char *Curl_dyn_take(struct dynbuf *s, size_t *plen);
/* Dynamic buffer max sizes */
#define MAX_DYNBUF_SIZE (SIZE_T_MAX/2)
#define DYN_DOH_RESPONSE 3000
#define DYN_DOH_CNAME 256
#define DYN_PAUSE_BUFFER (64 * 1024 * 1024)
@ -95,4 +97,5 @@ char *Curl_dyn_take(struct dynbuf *s, size_t *plen);
#define DYN_PINGPPONG_CMD (64*1024)
#define DYN_IMAP_CMD (64*1024)
#define DYN_MQTT_RECV (64*1024)
#define DYN_CRLFILE_SIZE 8000000
#endif