summaryrefslogtreecommitdiff
path: root/source4/dsdb/kcc
diff options
context:
space:
mode:
authorAndreas Schneider <asn@samba.org>2017-07-24 12:13:50 +0200
committerAndreas Schneider <asn@cryptomilk.org>2017-07-24 14:50:11 +0200
commit314cf608932c21d593afd04769b07435bcd4fc53 (patch)
tree3eaefe77fe4ef956999d1840f084225ea6b28119 /source4/dsdb/kcc
parent9d4a9bd3cc6d5031b4cb6120be8d261350a8bdfc (diff)
downloadsamba-314cf608932c21d593afd04769b07435bcd4fc53.tar.gz
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 <asn@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
Diffstat (limited to 'source4/dsdb/kcc')
-rw-r--r--source4/dsdb/kcc/kcc_topology.c4
1 files changed, 4 insertions, 0 deletions
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];