gssproxy/Fix-another-incorrect-use-of-non-null-term.-string.patch

34 lines
1.3 KiB
Diff

From a69d4d16327916d6dde549aa0873ed1323248c8c Mon Sep 17 00:00:00 2001
From: Simo Sorce <simo@redhat.com>
Date: Thu, 23 Feb 2017 13:32:06 -0500
Subject: [PATCH] Fix another incorrect use of non-null term. string
Signed-off-by: Simo Sorce <simo@redhat.com>
Reviewed-by: Robbie Harwood <rharwood@redhat.com>
PR: #50
(cherry picked from commit 02d9a798c1019f93579e5d29b0b21c0570717dc2)
---
proxy/src/mechglue/gpp_creds.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/proxy/src/mechglue/gpp_creds.c b/proxy/src/mechglue/gpp_creds.c
index 38d03fd..37517d6 100644
--- a/proxy/src/mechglue/gpp_creds.c
+++ b/proxy/src/mechglue/gpp_creds.c
@@ -103,9 +103,12 @@ OM_uint32 gppint_retrieve_remote_creds(uint32_t *min, const char *ccache_name,
if (ret) goto done;
if (name) {
- ret = krb5_parse_name(ctx,
- name->display_name.octet_string_val,
- &icred.client);
+ char client_name[name->display_name.octet_string_len + 1];
+ memcpy(client_name, name->display_name.octet_string_val,
+ name->display_name.octet_string_len);
+ client_name[name->display_name.octet_string_len] = '\0';
+
+ ret = krb5_parse_name(ctx, client_name, &icred.client);
} else {
ret = krb5_cc_get_principal(ctx, ccache, &icred.client);
}