summaryrefslogtreecommitdiffstats
path: root/src/providers/ldap/sdap.c
diff options
context:
space:
mode:
authorJakub Hrozek <jhrozek@redhat.com>2014-04-21 21:33:36 +0200
committerJakub Hrozek <jhrozek@redhat.com>2014-05-02 13:34:31 +0200
commitfcb8e3f1f49bb34c409d8dbd75889eb72be05517 (patch)
tree16b950c7ba3c1b14969417480f66424404647024 /src/providers/ldap/sdap.c
parented61bfc5184d9c7a46d17681a22a1abb64423708 (diff)
downloadsssd-fcb8e3f1f49bb34c409d8dbd75889eb72be05517.tar.gz
sssd-fcb8e3f1f49bb34c409d8dbd75889eb72be05517.tar.xz
sssd-fcb8e3f1f49bb34c409d8dbd75889eb72be05517.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>
Diffstat (limited to 'src/providers/ldap/sdap.c')
-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;
}