6405db
From 28529671057c95327a35c326ee99fcafccad9de9 Mon Sep 17 00:00:00 2001
6405db
From: Thierry Bordaz <tbordaz@redhat.com>
6405db
Date: Wed, 14 Jun 2017 18:36:55 +0200
6405db
Subject: [PATCH] Ticket 49291 - slapi_search_internal_callback_pb may SIGSEV
6405db
 if related pblock has not operation set
6405db
6405db
Bug Description:
6405db
    if slapi_search_internal_set_pb is called with an invalid (NULL) base, the pblock should not
6405db
    be used to call send_ldap_result. If it is, the send_ldap_result trying to derefence the
6405db
    operation pointer will crash
6405db
6405db
Fix Description:
6405db
    Check that the operation is set before derefencing it
6405db
6405db
https://pagure.io/389-ds-base/issue/49291
6405db
6405db
Reviewed by: Mark Reynolds
6405db
6405db
Platforms tested: F23
6405db
6405db
Flag Day: no
6405db
6405db
Doc impact: no
6405db
---
6405db
 ldap/servers/slapd/result.c | 5 +++++
6405db
 1 file changed, 5 insertions(+)
6405db
6405db
diff --git a/ldap/servers/slapd/result.c b/ldap/servers/slapd/result.c
6405db
index 56257c3..f3016ca 100644
6405db
--- a/ldap/servers/slapd/result.c
6405db
+++ b/ldap/servers/slapd/result.c
6405db
@@ -350,6 +350,11 @@ send_ldap_result_ext(
6405db
 	slapi_pblock_get (pb, SLAPI_BIND_METHOD, &bind_method);
6405db
 	slapi_pblock_get (pb, SLAPI_OPERATION, &operation);
6405db
 
6405db
+	if (operation == NULL) {
6405db
+		slapi_log_err(SLAPI_LOG_ERR, "send_ldap_result_ext", "No operation found: slapi_search_internal_set_pb was incomplete (invalid 'base' ?)\n");
6405db
+		return;
6405db
+	}
6405db
+
6405db
 	if (operation->o_status == SLAPI_OP_STATUS_RESULT_SENT) {
6405db
 		return; /* result already sent */
6405db
 	}
6405db
-- 
6405db
2.9.5
6405db