diff options
author | ngie <ngie@FreeBSD.org> | 2016-06-10 14:48:10 +0000 |
---|---|---|
committer | ngie <ngie@FreeBSD.org> | 2016-06-10 14:48:10 +0000 |
commit | 12a9f65ec7dc08f8f53bc3015b618fddddf49d71 (patch) | |
tree | 81192425a5b0dbbb77be54877b93697f84cc3f24 | |
parent | f17a072a07c9241f9501289da18753df26f4abdc (diff) | |
download | FreeBSD-src-12a9f65ec7dc08f8f53bc3015b618fddddf49d71.zip FreeBSD-src-12a9f65ec7dc08f8f53bc3015b618fddddf49d71.tar.gz |
MFC r299495:
r299495 (by cem):
libkrb5: Fix potential double-free
If krb5_make_principal fails, tmp_creds.server may remain a pointer to freed
memory and then be double-freed. After freeing it the first time, initialize
it to NULL, which causes subsequent krb5_free_principal calls to do the right
thing.
CID: 1273430
-rw-r--r-- | crypto/heimdal/lib/krb5/get_cred.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/crypto/heimdal/lib/krb5/get_cred.c b/crypto/heimdal/lib/krb5/get_cred.c index e3bb23a..9914fe4 100644 --- a/crypto/heimdal/lib/krb5/get_cred.c +++ b/crypto/heimdal/lib/krb5/get_cred.c @@ -831,6 +831,7 @@ get_cred_kdc_capath_worker(krb5_context context, if(strcmp(tgt_inst, server_realm) == 0) break; krb5_free_principal(context, tmp_creds.server); + tmp_creds.server = NULL; ret = krb5_make_principal(context, &tmp_creds.server, tgt_inst, KRB5_TGS_NAME, server_realm, NULL); if(ret) { |