From a196a36dce9fc571c747e20a90f350822aeb49be Mon Sep 17 00:00:00 2001 From: Theodore Tso Date: Wed, 16 Jul 1997 02:06:22 +0000 Subject: [PATCH] Always copy the mechtype so that delete_sec_context() can safely release the OID without smashing memory passed in by the application. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@10117 dc483132-0cff-0310-8789-dd5450dbe970 --- src/lib/gssapi/krb5/ChangeLog | 6 ++++++ src/lib/gssapi/krb5/init_sec_context.c | 6 +++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/lib/gssapi/krb5/ChangeLog b/src/lib/gssapi/krb5/ChangeLog index 0c65bf13b..350515897 100644 --- a/src/lib/gssapi/krb5/ChangeLog +++ b/src/lib/gssapi/krb5/ChangeLog @@ -1,3 +1,9 @@ +Tue Jul 15 22:05:21 1997 Theodore Y. Ts'o + + * init_sec_context.c (krb5_gss_init_sec_context): Always copy the + mechtype so that delete_sec_context() can safely release + the OID without smashing memory passed in by the application. + Mon Jun 30 14:05:51 1997 Kevin L Mitchell * accept_sec_context.c: added code to return a valid delegated diff --git a/src/lib/gssapi/krb5/init_sec_context.c b/src/lib/gssapi/krb5/init_sec_context.c index ac6ffa232..b3992bd7d 100644 --- a/src/lib/gssapi/krb5/init_sec_context.c +++ b/src/lib/gssapi/krb5/init_sec_context.c @@ -324,7 +324,11 @@ krb5_gss_init_sec_context(minor_status, claimant_cred_handle, /* fill in the ctx */ memset(ctx, 0, sizeof(krb5_gss_ctx_id_rec)); - ctx->mech_used = mech_type; + if (generic_gss_copy_oid(minor_status, mech_type, &ctx->mech_used) + != GSS_S_COMPLETE) { + free(ctx); + return (GSS_S_FAILURE); + } ctx->auth_context = NULL; ctx->initiate = 1; ctx->gss_flags = KG_IMPLFLAGS(req_flags); -- 2.26.2