From e18d5c703c529f99bd375da887d9aeaee6b82fcd Mon Sep 17 00:00:00 2001 From: Lukas Slebodnik Date: Fri, 21 Mar 2014 17:14:48 +0100 Subject: AUTOFS: terminate array after the last entry MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit If LDAP entries have more then one attribute "automountKey" automount map will be skipped and error message will be printed to log files and sssd_be will crash. DEBUG(SSSDBG_MINOR_FAILURE, "Malformed entry, skipping\n"); The output array with automount maps will contain uninitialized pointers because array was terminated after the expected count of entries and not after the last successfully retrieved entry Resolves: https://fedorahosted.org/sssd/ticket/2288 Reviewed-by: Pavel Březina --- src/providers/ldap/sdap_async_autofs.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/providers/ldap/sdap_async_autofs.c b/src/providers/ldap/sdap_async_autofs.c index 616a3b9a5..1db8d2067 100644 --- a/src/providers/ldap/sdap_async_autofs.c +++ b/src/providers/ldap/sdap_async_autofs.c @@ -844,7 +844,8 @@ sdap_autofs_setautomntent_save(struct tevent_req *req) j++; } - ldap_entrylist[state->entries_count] = NULL; + /* terminate array with NULL after the last retrieved entry */ + ldap_entrylist[j] = NULL; } ret = sysdb_autofs_entries_by_map(tmp_ctx, state->dom, state->mapname, -- cgit