← Commit list

f91be14bfb

Daniel Stenberg
Daniel Stenberg
2025-10-16
SUCCESS Duration: 224s

Subject

openldap: limit max incoming size

Binary

No binary (build failed)

Architecture & Compiler Flags

Architecture: x86_64-linux-gnu Compiler: gcc (Ubuntu 11.4.0-1ubuntu1~22.04.3) 11.4.0

—

Build Log

(log yok)

Commit Diff GitHub →

lib/openldap.c+13 -0
@@ -659,6 +659,19 @@ static CURLcode oldap_connect(struct Curl_easy *data, bool *done)
/* Do not chase referrals. */
ldap_set_option(li->ld, LDAP_OPT_REFERRALS, LDAP_OPT_OFF);
+ {
+ ber_len_t max = 256*1024;
+ Sockbuf *sb;
+ if(ldap_get_option(li->ld, LDAP_OPT_SOCKBUF, (void **)&sb) ||
+ /* Set the maximum allowed size of an incoming message, which to
+ OpenLDAP means that it will malloc() memory up to this size. If not
+ set, there is no limit and we instead risk a malloc() failure. */
+ ber_sockbuf_ctrl(sb, LBER_SB_OPT_SET_MAX_INCOMING, &max)) {
+ result = CURLE_FAILED_INIT;
+ goto out;
+ }
+ }
+
#ifdef USE_SSL
if(Curl_conn_is_ssl(conn, FIRSTSOCKET)) {
result = oldap_ssl_connect(data, OLDAP_SSL);