From 6bf9a774718917c3429fa1492f5b0268ae5e01c3 Mon Sep 17 00:00:00 2001 From: Alistair Leslie-Hughes Date: Fri, 27 Sep 2013 08:31:00 +1000 Subject: Stop use after free Fixes bug #10087 Thanks to Man Min Yan for their analysis and providing a solution to the issue. Reviewed-by: Jeremy Allison Reviewed-by: Andreas Schneider Autobuild-User(master): Jeremy Allison Autobuild-Date(master): Fri Sep 27 14:29:46 CEST 2013 on sn-devel-104 --- source3/utils/ntlm_auth.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'source3/utils') diff --git a/source3/utils/ntlm_auth.c b/source3/utils/ntlm_auth.c index 8d556298ca..1df615c1e7 100644 --- a/source3/utils/ntlm_auth.c +++ b/source3/utils/ntlm_auth.c @@ -1678,7 +1678,11 @@ static void manage_gensec_request(enum stdio_helper_mode stdio_helper_mode, } else { reply_code = "AF"; - reply_arg = session_info->unix_info->unix_name; + reply_arg = talloc_strdup(state->gensec_state, session_info->unix_info->unix_name); + if (reply_arg == NULL) { + reply_code = "BH out of memory"; + reply_arg = nt_errstr(NT_STATUS_NO_MEMORY); + } talloc_free(session_info); } } else if (state->gensec_state->gensec_role == GENSEC_CLIENT) { -- cgit