From ab8104814996e610f4cd4c22b95e21a518ef11f7 Mon Sep 17 00:00:00 2001 From: Thierry Bordaz Date: Jun 15 2017 16:19:11 +0000 Subject: Ticket 49291 - slapi_search_internal_callback_pb may SIGSEV if related pblock has not operation set Bug Description: if slapi_search_internal_set_pb is called with an invalid (NULL) base, the pblock should not be used to call send_ldap_result. If it is, the send_ldap_result trying to derefence the operation pointer will crash Fix Description: Check that the operation is set before derefencing it https://pagure.io/389-ds-base/issue/49291 Reviewed by: Mark Reynolds Platforms tested: F23 Flag Day: no Doc impact: no --- diff --git a/ldap/servers/slapd/result.c b/ldap/servers/slapd/result.c index 90b8887..a16c8e1 100644 --- a/ldap/servers/slapd/result.c +++ b/ldap/servers/slapd/result.c @@ -351,6 +351,11 @@ send_ldap_result_ext( slapi_pblock_get (pb, SLAPI_OPERATION, &operation); slapi_pblock_get(pb, SLAPI_CONNECTION, &conn); + if (operation == NULL) { + slapi_log_err(SLAPI_LOG_ERR, "send_ldap_result_ext", "No operation found: slapi_search_internal_set_pb was incomplete (invalid 'base' ?)\n"); + return; + } + if (operation->o_status == SLAPI_OP_STATUS_RESULT_SENT) { return; /* result already sent */ }