From 111269d484e912e745ebf0852a06d3b5d426fa30 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Wed, 26 Feb 2014 20:16:26 +0100 Subject: [PATCH] s3:winbindd: make use of talloc_string_sub2() in generate_krb5_ccache() This way we don't pass a given format string to talloc_asprintf(). Signed-off-by: Stefan Metzmacher Reviewed-by: Jeremy Allison --- source3/winbindd/winbindd_pam.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/source3/winbindd/winbindd_pam.c b/source3/winbindd/winbindd_pam.c index 53519375c7f..d56d2fa23ea 100644 --- a/source3/winbindd/winbindd_pam.c +++ b/source3/winbindd/winbindd_pam.c @@ -512,7 +512,20 @@ static const char *generate_krb5_ccache(TALLOC_CTX *mem_ctx, p++; if (p != NULL && *p == 'u' && strchr(p, '%') == NULL) { - gen_cc = talloc_asprintf(mem_ctx, type, uid); + char uid_str[sizeof("18446744073709551615")]; + + snprintf(uid_str, sizeof(uid_str), "%u", uid); + + gen_cc = talloc_string_sub2(mem_ctx, + type, + "%u", + uid_str, + /* remove_unsafe_characters */ + false, + /* replace_once */ + true, + /* allow_trailing_dollar */ + false); } } } -- 2.11.4.GIT