openldap: avoid indexing the result at -1 for blank responses

Reported-by: Joshua Rogers

Closes #18600
This commit is contained in:
Daniel Stenberg 2025-09-18 15:02:03 +02:00
parent 5cc2b83446
commit 232d5a2ed9
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2

View 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 */