From e18d5c703c529f99bd375da887d9aeaee6b82fcd Mon Sep 17 00:00:00 2001 From: Lukas Slebodnik Date: Apr 04 2014 12:14:03 +0000 Subject: AUTOFS: terminate array after the last entry 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 --- diff --git a/src/providers/ldap/sdap_async_autofs.c b/src/providers/ldap/sdap_async_autofs.c index 616a3b9..1db8d20 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,