From 232d5a2ed9c091c88e3b724a1e7d6d6e6cac0079 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Thu, 18 Sep 2025 15:02:03 +0200 Subject: [PATCH] openldap: avoid indexing the result at -1 for blank responses Reported-by: Joshua Rogers Closes #18600 --- lib/openldap.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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 */ -- 2.47.3