summaryrefslogtreecommitdiffstats
path: root/src/providers/ldap
diff options
context:
space:
mode:
authorJakub Hrozek <jhrozek@redhat.com>2014-04-21 21:33:36 +0200
committerJakub Hrozek <jhrozek@redhat.com>2014-06-03 11:31:59 +0200
commit7f42b25ce49b818b534015d078bd51ee612c465c (patch)
tree2865759af15ba43bb88d2c64c4c5baef0c87a600 /src/providers/ldap
parenta656aa32f20612ff9b17637ef1ea08df4ffdfa26 (diff)
downloadsssd-7f42b25ce49b818b534015d078bd51ee612c465c.tar.gz
sssd-7f42b25ce49b818b534015d078bd51ee612c465c.tar.xz
sssd-7f42b25ce49b818b534015d078bd51ee612c465c.zip
LDAP: Fix off-by-one bug in sdap_copy_opts
The sdap_copy_opts function copied all the arguments except for the sentinel. Reviewed-by: Simo Sorce <simo@redhat.com> Reviewed-by: Pavel Březina <pbrezina@redhat.com> (cherry picked from commit fcb8e3f1f49bb34c409d8dbd75889eb72be05517)
Diffstat (limited to 'src/providers/ldap')
-rw-r--r--src/providers/ldap/sdap.c5
1 files changed, 4 insertions, 1 deletions
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;
}