openldap: improve check for receiving blank data

It can't access the first byte either unless it has length.

Followup to 232d5a2ed9c091c88e3b724a1e7d6

Closes #18632
This commit is contained in:
Daniel Stenberg 2025-09-20 12:21:26 +02:00
parent 66d6075af9
commit 979366a625
No known key found for this signature in database
GPG Key ID: 5CC908FDB71E12C2

View File

@ -1171,8 +1171,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]) ||
(bvals[i].bv_len &&
if(bvals[i].bv_len &&
(ISBLANK(bvals[i].bv_val[0]) ||
ISBLANK(bvals[i].bv_val[bvals[i].bv_len - 1])))
binval = TRUE;
else {