From ce8f495ece6bdbf217479b73de3038f3640a6ed7 Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Mon, 24 Jul 2017 12:13:50 +0200 Subject: [PATCH 1/2] 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.13.3 From d1f82bfc699d6cc9b72bc906250dbb7f44a6eac7 Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Mon, 24 Jul 2017 12:19:27 +0200 Subject: [PATCH 2/2] mit-kdb: Fix NULL pointer check after malloc This fixes building with GCC 7.1. BUG: https://bugzilla.samba.org/show_bug.cgi?id=12930 Signed-off-by: Andreas Schneider Reviewed-by: Ralph Boehme Autobuild-User(master): Andreas Schneider Autobuild-Date(master): Mon Jul 24 18:45:34 CEST 2017 on sn-devel-144 --- source4/kdc/mit-kdb/kdb_samba_pac.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source4/kdc/mit-kdb/kdb_samba_pac.c b/source4/kdc/mit-kdb/kdb_samba_pac.c index 0ab8c372e0e..15497603b10 100644 --- a/source4/kdc/mit-kdb/kdb_samba_pac.c +++ b/source4/kdc/mit-kdb/kdb_samba_pac.c @@ -87,7 +87,7 @@ krb5_error_code kdb_samba_dbekd_encrypt_key_data(krb5_context context, key_data->key_data_kvno = keyver; key_data->key_data_type[0] = kkey->enctype; key_data->key_data_contents[0] = malloc(kkey->length); - if (key_data->key_data_contents[0]) { + if (key_data->key_data_contents[0] == NULL) { return ENOMEM; } memcpy(key_data->key_data_contents[0], -- 2.13.3