summaryrefslogtreecommitdiff
path: root/source3/libads
diff options
context:
space:
mode:
authorMatt Rogers <mrogers@redhat.com>2014-11-12 17:21:05 +0100
committerKarolin Seeger <kseeger@samba.org>2014-11-17 21:21:12 +0100
commit60501b07bea5b6ce77521d4b602c42d0cb27900c (patch)
treeed5dc99312f25213f79e2c0861701954d9ded05a /source3/libads
parent1d9c15fd790e665ccd5caa990664e114d547eaa4 (diff)
downloadsamba-60501b07bea5b6ce77521d4b602c42d0cb27900c.tar.gz
s3-keytab: fix keytab array NULL termination.
Signed-off-by: Matt Rogers <mrogers@redhat.com> Reviewed-by: Guenther Deschner <gd@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org> (cherry picked from commit 0de6799996955fbf8e19ace8c4b7b61f5a262cb5) BUG: https://bugzilla.samba.org/show_bug.cgi?id=10933 net ads join -k can segfault with existing keytab entries
Diffstat (limited to 'source3/libads')
-rw-r--r--source3/libads/kerberos_keytab.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/source3/libads/kerberos_keytab.c b/source3/libads/kerberos_keytab.c
index d13625b27e7..56f0a772b51 100644
--- a/source3/libads/kerberos_keytab.c
+++ b/source3/libads/kerberos_keytab.c
@@ -664,14 +664,13 @@ int ads_keytab_create_default(ADS_STRUCT *ads)
goto done;
}
- oldEntries = talloc_array(frame, char *, found);
+ oldEntries = talloc_zero_array(frame, char *, found + 1);
if (!oldEntries) {
DEBUG(1, (__location__ ": Failed to allocate space to store "
"the old keytab entries (talloc failed?).\n"));
ret = -1;
goto done;
}
- memset(oldEntries, '\0', found * sizeof(char *));
ret = krb5_kt_start_seq_get(context, keytab, &cursor);
if (ret == KRB5_KT_END || ret == ENOENT) {