From 314cf608932c21d593afd04769b07435bcd4fc53 Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Mon, 24 Jul 2017 12:13:50 +0200 Subject: [PATCH] s4:kcc: Add a NULL check before qsort() This fixes building with GCC 7.1.1 BUG: https://bugzilla.samba.org/show_bug.cgi?id=12930 Signed-off-by: Andreas Schneider Reviewed-by: Ralph Boehme --- source4/dsdb/kcc/kcc_topology.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/source4/dsdb/kcc/kcc_topology.c b/source4/dsdb/kcc/kcc_topology.c index cd4dcc55495..0e136ed7936 100644 --- a/source4/dsdb/kcc/kcc_topology.c +++ b/source4/dsdb/kcc/kcc_topology.c @@ -2445,6 +2445,10 @@ static NTSTATUS kcctpl_kruskal(TALLOC_CTX *mem_ctx, struct kcctpl_graph *graph, uint32_t i, num_expected_tree_edges, cst_edges; struct kcctpl_multi_edge_list output_edges; + if (internal_edges.data == NULL || internal_edges.count == 0) { + return NT_STATUS_INVALID_PARAMETER; + } + num_expected_tree_edges = 0; for (i = 0; i < graph->vertices.count; i++) { struct kcctpl_vertex *vertex = &graph->vertices.data[i]; -- 2.11.4.GIT