]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
openldap: fix limit max incoming size test logic
authorJochen Sprickerhof <git@jochen.sprickerhof.de>
Sun, 19 Oct 2025 07:40:35 +0000 (09:40 +0200)
committerDaniel Stenberg <daniel@haxx.se>
Sun, 19 Oct 2025 11:12:07 +0000 (13:12 +0200)
Use LDAP_OPT_SUCCESS for ldap_get_option, as done in the other calls.
ber_sockbuf_ctrl returns 1 on success so reverse the logic.

Follow-up to f91be14bfb
Closes #19138

lib/openldap.c

index d7eefaa6779538966749bf4acd728cc10b937697..dbf2f5f4f368152f24e48efe15bc964ff11f0034 100644 (file)
@@ -662,11 +662,11 @@ static CURLcode oldap_connect(struct Curl_easy *data, bool *done)
   {
     ber_len_t max = 256*1024;
     Sockbuf *sb;
-    if(ldap_get_option(li->ld, LDAP_OPT_SOCKBUF, (void **)&sb) ||
+    if((ldap_get_option(li->ld, LDAP_OPT_SOCKBUF, &sb) != LDAP_OPT_SUCCESS) ||
        /* 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)) {
+       !ber_sockbuf_ctrl(sb, LBER_SB_OPT_SET_MAX_INCOMING, &max)) {
       result = CURLE_FAILED_INIT;
       goto out;
     }