File curl-7.37.0-CVE-2018-1000121.patch of Package curl.openSUSE_Leap_42.3_Update
From e35ddd24457bf1169e9a572e4ffbda89321f1a2e Mon Sep 17 00:00:00 2001
From: Daniel Stenberg <daniel@haxx.se>
Date: Tue, 6 Mar 2018 23:02:16 +0100
Subject: [PATCH] openldap: check ldap_get_attribute_ber() results for NULL
before using
Reported-by: Dario Weisser
---
lib/openldap.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
Index: curl-7.37.0/lib/openldap.c
===================================================================
--- curl-7.37.0.orig/lib/openldap.c
+++ curl-7.37.0/lib/openldap.c
@@ -435,7 +435,7 @@ static ssize_t ldap_recv(struct connectd
for(ent = ldap_first_message(li->ld, result); ent;
ent = ldap_next_message(li->ld, ent)) {
- struct berval bv, *bvals, **bvp = &bvals;
+ struct berval bv, *bvals;
int binary = 0, msgtype;
msgtype = ldap_msgtype(ent);
@@ -481,9 +481,9 @@ static ssize_t ldap_recv(struct connectd
Curl_client_write(conn, CLIENTWRITE_BODY, (char *)"\n", 1);
data->req.bytecount += bv.bv_len + 5;
- for(rc = ldap_get_attribute_ber(li->ld, ent, ber, &bv, bvp);
- rc == LDAP_SUCCESS;
- rc = ldap_get_attribute_ber(li->ld, ent, ber, &bv, bvp)) {
+ for(rc = ldap_get_attribute_ber(li->ld, ent, ber, &bv, &bvals);
+ (rc == LDAP_SUCCESS) && bvals;
+ rc = ldap_get_attribute_ber(li->ld, ent, ber, &bv, &bvals)) {
int i;
if(bv.bv_val == NULL) break;