diff options
author | Uri Simchoni <urisimchoni@gmail.com> | 2015-05-02 13:44:52 +0300 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2015-05-04 18:24:21 +0200 |
commit | df91bc5159b24f6f10fd9742b49192921d51f821 (patch) | |
tree | 16d79611bf972d46e424cb4ae23c4194c4240a70 /source3/libads | |
parent | 9343386b91c3de6b5f238169d34390afc1ee069f (diff) | |
download | samba-df91bc5159b24f6f10fd9742b49192921d51f821.tar.gz |
libads: Fix free of uninitialized pointer
In ads_keytab_creat_default(), if the keytab to be created cannot
be opened, the bail-out code calls smb_krb5_kt_free_entry() on
an uninitialized entry.
To reproduce:
1. Join a domain
2. KRB5_KTNAME=FILE:/non-existant-path/krb5.keytab net ads keytab create -P
Signed-off-by: Uri Simchoni <urisimchoni@gmail.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
Diffstat (limited to 'source3/libads')
-rw-r--r-- | source3/libads/kerberos_keytab.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/source3/libads/kerberos_keytab.c b/source3/libads/kerberos_keytab.c index bbd981c6159..ef6374ae7be 100644 --- a/source3/libads/kerberos_keytab.c +++ b/source3/libads/kerberos_keytab.c @@ -520,6 +520,9 @@ int ads_keytab_create_default(ADS_STRUCT *ads) size_t i; ADS_STATUS status; + ZERO_STRUCT(kt_entry); + ZERO_STRUCT(cursor); + frame = talloc_stackframe(); if (frame == NULL) { ret = -1; @@ -575,8 +578,6 @@ int ads_keytab_create_default(ADS_STRUCT *ads) #endif memset(princ_s, '\0', sizeof(princ_s)); - ZERO_STRUCT(kt_entry); - ZERO_STRUCT(cursor); initialize_krb5_error_table(); ret = krb5_init_context(&context); |