(gss_display_name): zero terminate output.

git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@4933 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
Assar Westerlund
1998-05-24 03:22:08 +00:00
parent 81873ef16c
commit e81a0128ee
2 changed files with 4 additions and 2 deletions

View File

@@ -59,12 +59,13 @@ OM_uint32 gss_display_name
return GSS_S_FAILURE;
len = strlen (buf);
output_name_buffer->length = len;
output_name_buffer->value = malloc(len);
output_name_buffer->value = malloc(len + 1);
if (output_name_buffer->value == NULL) {
free (buf);
return GSS_S_FAILURE;
}
memcpy (output_name_buffer->value, buf, len);
((char *)output_name_buffer->value)[len] = '\0';
free (buf);
if (output_name_type)
*output_name_type = GSS_KRB5_NT_PRINCIPAL_NAME;

View File

@@ -59,12 +59,13 @@ OM_uint32 gss_display_name
return GSS_S_FAILURE;
len = strlen (buf);
output_name_buffer->length = len;
output_name_buffer->value = malloc(len);
output_name_buffer->value = malloc(len + 1);
if (output_name_buffer->value == NULL) {
free (buf);
return GSS_S_FAILURE;
}
memcpy (output_name_buffer->value, buf, len);
((char *)output_name_buffer->value)[len] = '\0';
free (buf);
if (output_name_type)
*output_name_type = GSS_KRB5_NT_PRINCIPAL_NAME;