From aa23e125b361073982db75f4100e6fa88a16b9aa Mon Sep 17 00:00:00 2001 From: Greg Hudson Date: Mon, 9 May 2011 18:16:14 +0000 Subject: [PATCH] Avoid calling gss_release_buffer() from the message-processing code in lib/gssapi/krb5. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@24919 dc483132-0cff-0310-8789-dd5450dbe970 --- src/lib/gssapi/krb5/k5unsealiov.c | 8 ++------ src/lib/gssapi/krb5/util_crypt.c | 13 ++++--------- 2 files changed, 6 insertions(+), 15 deletions(-) diff --git a/src/lib/gssapi/krb5/k5unsealiov.c b/src/lib/gssapi/krb5/k5unsealiov.c index 8b67631d9..6ca57bc6c 100644 --- a/src/lib/gssapi/krb5/k5unsealiov.c +++ b/src/lib/gssapi/krb5/k5unsealiov.c @@ -599,12 +599,8 @@ kg_unseal_stream_iov(OM_uint32 *minor_status, tiov, i, toktype); if (major_status == GSS_S_COMPLETE) *data = *tdata; - else if (tdata->type & GSS_IOV_BUFFER_FLAG_ALLOCATED) { - OM_uint32 tmp; - - gss_release_buffer(&tmp, &tdata->buffer); - tdata->type &= ~(GSS_IOV_BUFFER_FLAG_ALLOCATED); - } + else + kg_release_iov(tdata, 1); cleanup: if (tiov != NULL) diff --git a/src/lib/gssapi/krb5/util_crypt.c b/src/lib/gssapi/krb5/util_crypt.c index 2db6ecb19..006381779 100644 --- a/src/lib/gssapi/krb5/util_crypt.c +++ b/src/lib/gssapi/krb5/util_crypt.c @@ -308,7 +308,6 @@ kg_arcfour_docrypt(const krb5_keyblock *keyblock, int usage, const unsigned char *input_buf, size_t input_len, unsigned char *output_buf) { - krb5_error_code code; krb5_data kd = make_data((char *) kd_data, kd_data_len); krb5_crypto_iov kiov; @@ -657,13 +656,14 @@ void kg_release_iov(gss_iov_buffer_desc *iov, int iov_count) { int i; - OM_uint32 min_stat; assert(iov != GSS_C_NO_IOV_BUFFER); for (i = 0; i < iov_count; i++) { if (iov[i].type & GSS_IOV_BUFFER_FLAG_ALLOCATED) { - gss_release_buffer(&min_stat, &iov[i].buffer); + free(iov[i].buffer.value); + iov[i].buffer.length = 0; + iov[i].buffer.value = NULL; iov[i].type &= ~(GSS_IOV_BUFFER_FLAG_ALLOCATED); } } @@ -677,7 +677,6 @@ kg_fixup_padding_iov(OM_uint32 *minor_status, gss_iov_buffer_desc *iov, gss_iov_buffer_t data = NULL; size_t padlength, relative_padlength; unsigned char *p; - OM_uint32 minor; data = kg_locate_iov(iov, iov_count, GSS_IOV_BUFFER_TYPE_DATA); padding = kg_locate_iov(iov, iov_count, GSS_IOV_BUFFER_TYPE_PADDING); @@ -730,11 +729,7 @@ kg_fixup_padding_iov(OM_uint32 *minor_status, gss_iov_buffer_desc *iov, data->buffer.length -= relative_padlength; - if (padding->type & GSS_IOV_BUFFER_FLAG_ALLOCATED) { - gss_release_buffer(&minor, &padding->buffer); - padding->type &= ~(GSS_IOV_BUFFER_FLAG_ALLOCATED); - } - + kg_release_iov(padding, 1); padding->buffer.length = 0; padding->buffer.value = NULL; -- 2.26.2