From: Daniel Stenberg Date: Thu, 18 Sep 2025 13:02:03 +0000 (+0200) Subject: openldap: avoid indexing the result at -1 for blank responses X-Git-Tag: rc-8_17_0-1~358 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=232d5a2ed9c091c88e3b724a1e7d6d6e6cac0079;p=thirdparty%2Fcurl.git openldap: avoid indexing the result at -1 for blank responses Reported-by: Joshua Rogers Closes #18600 --- diff --git a/lib/openldap.c b/lib/openldap.c index da26d4a78d..1f8737f524 100644 --- a/lib/openldap.c +++ b/lib/openldap.c @@ -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 */