Explorar o código

Bug 611790 - fix coverify Defect Type: Null pointer dereferences issues 11940 - 12166

https://bugzilla.redhat.com/show_bug.cgi?id=611790
Resolves: bug 611790
Bug description: Fix coverify Defect Type: Null pointer dereferences issues 11940 - 12166
Fix description: Catch possible NULL pointer in windows_search_entry_ext().
Endi S. Dewata %!s(int64=15) %!d(string=hai) anos
pai
achega
a85e68002e
Modificáronse 1 ficheiros con 7 adicións e 0 borrados
  1. 7 0
      ldap/servers/plugins/replication/windows_connection.c

+ 7 - 0
ldap/servers/plugins/replication/windows_connection.c

@@ -626,6 +626,12 @@ windows_search_entry_ext(Repl_Connection *conn, char* searchbase, char *filter,
 
 	LDAPDebug( LDAP_DEBUG_TRACE, "=> windows_search_entry\n", 0, 0, 0 );
 
+	if (!entry) {
+		LDAPDebug( LDAP_DEBUG_ANY, "windows_search_entry: NULL entry\n", 0, 0, 0 );
+		return_value = CONN_LOCAL_ERROR; /* entry should never == NULL here */
+		goto done;
+	}
+
 	*entry = NULL;
 
 	if (windows_conn_connected(conn))
@@ -702,6 +708,7 @@ windows_search_entry_ext(Repl_Connection *conn, char* searchbase, char *filter,
 	{
 		return_value = CONN_NOT_CONNECTED;
 	}
+done:
 	LDAPDebug( LDAP_DEBUG_TRACE, "<= windows_search_entry\n", 0, 0, 0 );
 	return return_value;
 }