Skip to content

Commit

Permalink
Clean up k5buf_to_gss helper
Browse files Browse the repository at this point in the history
k5buf_to_gss was used in only one place (generic_gss_oid_to_str),
where we want to include the terminating null byte in the GSS buffer.
Remove that assumption from the helper, and instead explicitly append
the null byte to the buffer before translating.
  • Loading branch information
greghudson committed Aug 23, 2012
1 parent bbe2600 commit be74d2e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/lib/gssapi/generic/gssapiP_generic.h
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ k5buf_to_gss(OM_uint32 *minor,
{
OM_uint32 status = GSS_S_COMPLETE;
char *bp = krb5int_buf_data(input_k5buf);
output_buffer->length = krb5int_buf_len(input_k5buf)+1;
output_buffer->length = krb5int_buf_len(input_k5buf);
#if defined(_WIN32) || defined(DEBUG_GSSALLOC)
if (output_buffer->length > 0) {
output_buffer->value = gssalloc_malloc(output_buffer->length);
Expand Down
6 changes: 2 additions & 4 deletions src/lib/gssapi/generic/oid_ops.c
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,6 @@ generic_gss_oid_to_str(OM_uint32 *minor_status,
OM_uint32 number;
OM_uint32 i;
unsigned char *cp;
char *bp;
struct k5buf buf;

if (minor_status != NULL)
Expand Down Expand Up @@ -271,9 +270,8 @@ generic_gss_oid_to_str(OM_uint32 *minor_status,
number = 0;
}
}
krb5int_buf_add(&buf, "}");
bp = krb5int_buf_data(&buf);
if (bp == NULL) {
krb5int_buf_add_len(&buf, "}\0", 2);
if (krb5int_buf_data(&buf) == NULL) {
*minor_status = ENOMEM;
return(GSS_S_FAILURE);
}
Expand Down

0 comments on commit be74d2e

Please sign in to comment.