]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
Stop use after free
authorAlistair Leslie-Hughes <leslie_alistair@hotmail.com>
Thu, 26 Sep 2013 22:31:00 +0000 (08:31 +1000)
committerKarolin Seeger <kseeger@samba.org>
Thu, 6 Feb 2014 10:42:33 +0000 (11:42 +0100)
Fixes bug #10087

Thanks to Man Min Yan for their analysis and providing a solution to the issue.

Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Fri Sep 27 14:29:46 CEST 2013 on sn-devel-104
(cherry picked from commit 6bf9a774718917c3429fa1492f5b0268ae5e01c3)

source3/utils/ntlm_auth.c

index 7cf40b905de188ed9ccf7db5a007162004e6658b..ad75e69dd0bd4b13fd2fe48c4e63a8e79ad44054 100644 (file)
@@ -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) {