]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
openldap: avoid indexing the result at -1 for blank responses
authorDaniel Stenberg <daniel@haxx.se>
Thu, 18 Sep 2025 13:02:03 +0000 (15:02 +0200)
committerDaniel Stenberg <daniel@haxx.se>
Thu, 18 Sep 2025 14:06:33 +0000 (16:06 +0200)
Reported-by: Joshua Rogers
Closes #18600

lib/openldap.c

index da26d4a78d0638af65053b54d32e3b8ed32895c2..1f8737f5243ab0e44e043dedb80a79602ffbf953 100644 (file)
@@ -1172,7 +1172,8 @@ static CURLcode oldap_recv(struct Curl_easy *data, int sockindex, char *buf,
         if(!binary) {
           /* check for leading or trailing whitespace */
           if(ISBLANK(bvals[i].bv_val[0]) ||
-             ISBLANK(bvals[i].bv_val[bvals[i].bv_len - 1]))
+             (bvals[i].bv_len &&
+              ISBLANK(bvals[i].bv_val[bvals[i].bv_len - 1])))
             binval = TRUE;
           else {
             /* check for unprintable characters */