summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
Diffstat (limited to 'source3')
-rw-r--r--source3/libads/kerberos.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/source3/libads/kerberos.c b/source3/libads/kerberos.c
index 227f95d15e..4fc23956bd 100644
--- a/source3/libads/kerberos.c
+++ b/source3/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: