From 63ffc670bff88a81a7664b4b3495e6b3b53218d4 Mon Sep 17 00:00:00 2001 From: Theodore Tso Date: Mon, 25 May 1998 01:44:13 +0000 Subject: [PATCH] util_ordering.c (g_order_free): rel_oid_set.c (generic_gss_release_oid_set): disp_major_status.c: General lint cleanup. util_oid.c (g_copy_OID_set): Copy the OID set with entirely dynamic memory (don't alias the contents of the OID set). git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@10576 dc483132-0cff-0310-8789-dd5450dbe970 --- src/lib/gssapi/generic/ChangeLog | 9 +++++++ src/lib/gssapi/generic/disp_major_status.c | 17 ++++++------ src/lib/gssapi/generic/rel_oid_set.c | 1 - src/lib/gssapi/generic/util_oid.c | 30 +++++++++++++++++++--- src/lib/gssapi/generic/util_ordering.c | 1 - 5 files changed, 44 insertions(+), 14 deletions(-) diff --git a/src/lib/gssapi/generic/ChangeLog b/src/lib/gssapi/generic/ChangeLog index 13f5718cf..a71aeb1cd 100644 --- a/src/lib/gssapi/generic/ChangeLog +++ b/src/lib/gssapi/generic/ChangeLog @@ -1,3 +1,12 @@ +1998-05-18 Theodore Ts'o + + * util_ordering.c (g_order_free): + * rel_oid_set.c (generic_gss_release_oid_set): + * disp_major_status.c: General lint cleanup. + + * util_oid.c (g_copy_OID_set): Copy the OID set with entirely + dynamic memory (don't alias the contents of the OID set). + Wed Apr 1 16:33:27 1998 Tom Yu * disp_major_status.c (g_display_major_status): Fix a typo in diff --git a/src/lib/gssapi/generic/disp_major_status.c b/src/lib/gssapi/generic/disp_major_status.c index df1e3a75c..899592ada 100644 --- a/src/lib/gssapi/generic/disp_major_status.c +++ b/src/lib/gssapi/generic/disp_major_status.c @@ -22,6 +22,7 @@ #include "gssapiP_generic.h" #include +#include /* * $Id$ @@ -135,7 +136,7 @@ static OM_uint32 display_calling(minor_status, code, status_string) { const char *str; - if (str = GSS_CALLING_ERROR_STR(code)) { + if ((str = GSS_CALLING_ERROR_STR(code))) { if (! g_make_string_buffer(str, status_string)) { *minor_status = ENOMEM; return(GSS_S_FAILURE); @@ -160,7 +161,7 @@ static OM_uint32 display_routine(minor_status, code, status_string) { const char *str; - if (str = GSS_ROUTINE_ERROR_STR(code)) { + if ((str = GSS_ROUTINE_ERROR_STR(code))) { if (! g_make_string_buffer(str, status_string)) { *minor_status = ENOMEM; return(GSS_S_FAILURE); @@ -185,7 +186,7 @@ static OM_uint32 display_bit(minor_status, code, status_string) { const char *str; - if (str = GSS_SINFO_STR(code)) { + if ((str = GSS_SINFO_STR(code))) { if (! g_make_string_buffer(str, status_string)) { *minor_status = ENOMEM; return(GSS_S_FAILURE); @@ -234,9 +235,9 @@ OM_uint32 g_display_major_status(minor_status, status_value, /*** do routine error */ if (*message_context == 0) { - if (tmp = GSS_ROUTINE_ERROR(status_value)) { + if ((tmp = GSS_ROUTINE_ERROR(status_value))) { status_value -= tmp; - if (ret = display_routine(minor_status, tmp, status_string)) + if ((ret = display_routine(minor_status, tmp, status_string))) return(ret); *minor_status = 0; if (status_value) { @@ -256,9 +257,9 @@ OM_uint32 g_display_major_status(minor_status, status_value, /*** do calling error */ if (*message_context == 1) { - if (tmp = GSS_CALLING_ERROR(status_value)) { + if ((tmp = GSS_CALLING_ERROR(status_value))) { status_value -= tmp; - if (ret = display_calling(minor_status, tmp, status_string)) + if ((ret = display_calling(minor_status, tmp, status_string))) return(ret); *minor_status = 0; if (status_value) { @@ -295,7 +296,7 @@ OM_uint32 g_display_major_status(minor_status, status_value, for (bit=0; (((OM_uint32) 1)<count = in->count; + len = sizeof(gss_OID_desc) * copy->count; if ((copy->elements = - (gss_OID_desc *) xmalloc(sizeof(gss_OID_desc)*copy->count)) == NULL) { + (gss_OID_desc *) xmalloc( len )) == NULL) { xfree(copy); return(0); } - for (i=0; icount; i++) - copy->elements[i] = in->elements[i]; + memset( copy->elements, 0, len ); + + for (i=0; icount; i++) { + len = in->elements[i].length; + new_oid = &(copy->elements[i]); + new_oid->elements = xmalloc( len ); + if ( new_oid->elements == NULL ) { + while( i>0 ) { + i--; + new_oid = &(copy->elements[i]); + if ( new_oid->elements!=NULL ) + xfree( new_oid->elements ); + } + xfree( copy->elements ); + xfree( copy ); + return( 0 ); + } + memcpy( new_oid->elements, in->elements[i].elements, len ); + new_oid->length = len; + } *out = copy; return(1); diff --git a/src/lib/gssapi/generic/util_ordering.c b/src/lib/gssapi/generic/util_ordering.c index b5b84234c..21a8b0641 100644 --- a/src/lib/gssapi/generic/util_ordering.c +++ b/src/lib/gssapi/generic/util_ordering.c @@ -168,7 +168,6 @@ void g_order_free(void **vqueue) { queue *q; - int i; q = (queue *) (*vqueue); -- 2.26.2