From 19c16ae0290fc1394f3bedef5376db8623ac2cf4 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Thu, 15 Feb 2018 16:00:33 +0100 Subject: [PATCH] winbind: avoid using fstrcpy(dcname,...) in _dual_init_connection domain->dcname was converted from fstring to char * by commit 14bae61ba36814ea5eca7c51cf1cc039e9e6803f. Luckily this was only ever called with an empty string in state->request->data.init_conn.dcname. BUG: https://bugzilla.samba.org/show_bug.cgi?id=13294 Signed-off-by: Stefan Metzmacher (cherry picked from commit d73e3d451976e692c6c346f98547d7123f7b9006) --- source3/winbindd/winbindd_util.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/source3/winbindd/winbindd_util.c b/source3/winbindd/winbindd_util.c index 6292cce9d51..9950c669629 100644 --- a/source3/winbindd/winbindd_util.c +++ b/source3/winbindd/winbindd_util.c @@ -781,7 +781,12 @@ enum winbindd_result winbindd_dual_init_connection(struct winbindd_domain *domai [sizeof(state->request->data.init_conn.dcname)-1]='\0'; if (strlen(state->request->data.init_conn.dcname) > 0) { - fstrcpy(domain->dcname, state->request->data.init_conn.dcname); + TALLOC_FREE(domain->dcname); + domain->dcname = talloc_strdup(domain, + state->request->data.init_conn.dcname); + if (domain->dcname == NULL) { + return WINBINDD_ERROR; + } } init_dc_connection(domain, false); -- 2.13.6