]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
openldap/ldap; check for binary attribute case insensitively
authorDaniel Stenberg <daniel@haxx.se>
Wed, 29 Oct 2025 08:11:09 +0000 (09:11 +0100)
committerDaniel Stenberg <daniel@haxx.se>
Wed, 29 Oct 2025 09:03:35 +0000 (10:03 +0100)
This bug was found with ZeroPath

Fixes #19240
Reported-by: Joshua Rogers
Closes #19273

lib/ldap.c
lib/openldap.c

index 8db1f41338b135c2615187d014218e49f7cd15ea..f0bc2f2a3790ca4b87a14fd89c3e8d2079deaf0c 100644 (file)
@@ -623,7 +623,7 @@ static CURLcode ldap_do(struct Curl_easy *data, bool *done)
           }
 
           if((attr_len > 7) &&
-             (strcmp(";binary", attr + (attr_len - 7)) == 0)) {
+             curl_strequal(";binary", attr + (attr_len - 7)) ) {
             /* Binary attribute, encode to base64. */
             if(vals[i]->bv_len) {
               result = curlx_base64_encode(vals[i]->bv_val, vals[i]->bv_len,
index dbf2f5f4f368152f24e48efe15bc964ff11f0034..f06587f0172458548633e2b3047d83e0cbbb30eb 100644 (file)
@@ -1096,7 +1096,6 @@ static CURLcode oldap_recv(struct Curl_easy *data, int sockindex, char *buf,
   BerElement *ber = NULL;
   struct timeval tv = {0, 0};
   struct berval bv, *bvals;
-  bool binary = FALSE;
   CURLcode result = CURLE_AGAIN;
   int code;
   char *info = NULL;
@@ -1167,6 +1166,7 @@ static CURLcode oldap_recv(struct Curl_easy *data, int sockindex, char *buf,
         rc == LDAP_SUCCESS;
         rc = ldap_get_attribute_ber(li->ld, msg, ber, &bv, &bvals)) {
       int i;
+      bool binary;
 
       if(!bv.bv_val)
         break;
@@ -1180,7 +1180,7 @@ static CURLcode oldap_recv(struct Curl_easy *data, int sockindex, char *buf,
       }
 
       binary = bv.bv_len > 7 &&
-        !strncmp(bv.bv_val + bv.bv_len - 7, ";binary", 7);
+        curl_strnequal(bv.bv_val + bv.bv_len - 7, ";binary", 7);
 
       for(i = 0; bvals[i].bv_val != NULL; i++) {
         bool binval = FALSE;