From fcb8e3f1f49bb34c409d8dbd75889eb72be05517 Mon Sep 17 00:00:00 2001 From: Jakub Hrozek Date: Mon, 21 Apr 2014 21:33:36 +0200 Subject: LDAP: Fix off-by-one bug in sdap_copy_opts MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The sdap_copy_opts function copied all the arguments except for the sentinel. Reviewed-by: Simo Sorce Reviewed-by: Pavel Březina --- src/providers/ldap/sdap.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/providers') diff --git a/src/providers/ldap/sdap.c b/src/providers/ldap/sdap.c index aa6b0e921..b303547a4 100644 --- a/src/providers/ldap/sdap.c +++ b/src/providers/ldap/sdap.c @@ -36,7 +36,7 @@ int sdap_copy_map(TALLOC_CTX *memctx, struct sdap_attr_map *map; int i; - map = talloc_array(memctx, struct sdap_attr_map, num_entries); + map = talloc_array(memctx, struct sdap_attr_map, num_entries + 1); if (!map) { return ENOMEM; } @@ -64,6 +64,9 @@ int sdap_copy_map(TALLOC_CTX *memctx, map[i].name ? map[i].name : ""); } + /* Include the sentinel */ + memset(&map[num_entries], 0, sizeof(struct sdap_attr_map)); + *_map = map; return EOK; } -- cgit