From 814c1b0e0034fb67c7718760dfcf913904f3e7fa Mon Sep 17 00:00:00 2001 From: Simo Sorce Date: Mon, 17 Dec 2007 15:21:38 -0500 Subject: [PATCH] While 'data' is usually 0 terminated, nothing in the spec requires that. The correct way is to copy only 'length' bytes. Simo. --- source/libads/kerberos.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/source/libads/kerberos.c b/source/libads/kerberos.c index 227f95d15e4..4fc23956bde 100644 --- a/source/libads/kerberos.c +++ b/source/libads/kerberos.c @@ -521,7 +521,10 @@ char *kerberos_get_default_realm_from_ccache( void ) #if defined(HAVE_KRB5_PRINCIPAL_GET_REALM) realm = SMB_STRDUP(krb5_principal_get_realm(ctx, princ)); #elif defined(HAVE_KRB5_PRINC_REALM) - realm = SMB_STRDUP(krb5_princ_realm(ctx, princ)->data); + { + krb5_data *realm_data = krb5_princ_realm(ctx, princ); + realm = SMB_STRNDUP(realm_data->data, realm_data->length); + } #endif out: -- 2.11.4.GIT