[SCM] Samba Shared Repository - branch v3-5-test updated

Karolin Seeger kseeger at samba.org
Thu Mar 17 08:04:34 MDT 2011


The branch, v3-5-test has been updated
       via  5d734a3 s3: Fix the talloc hierarchy in shadow_copy2_connectpath
      from  fca681f WHATSNEW: Update release notes for 3.5.8.

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-5-test


- Log -----------------------------------------------------------------
commit 5d734a32d9719d05f1dc53b3f61535778a7cdbf3
Author: Volker Lendecke <vl at samba.org>
Date:   Mon Mar 14 18:35:36 2011 +0100

    s3: Fix the talloc hierarchy in shadow_copy2_connectpath
    
    We have to return on talloc_tos() because we don't have a mem_ctx given to us.
    So we have to create a separate temporary talloc context.
    
    Fix bug #8011 (memory corruption in shadow_copy2).
    
    Autobuild-User: Volker Lendecke <vlendec at samba.org>
    Autobuild-Date: Mon Mar 14 19:21:11 CET 2011 on sn-devel-104
    (cherry picked from commit 746b299ec1b11ea1e70c130b69a9a379ec478750)

-----------------------------------------------------------------------

Summary of changes:
 source3/modules/vfs_shadow_copy2.c |   11 +++++++++--
 1 files changed, 9 insertions(+), 2 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/modules/vfs_shadow_copy2.c b/source3/modules/vfs_shadow_copy2.c
index 61f71b7..e1b1c17 100644
--- a/source3/modules/vfs_shadow_copy2.c
+++ b/source3/modules/vfs_shadow_copy2.c
@@ -582,7 +582,7 @@ static char *shadow_copy2_realpath(vfs_handle_struct *handle,
 static const char *shadow_copy2_connectpath(struct vfs_handle_struct *handle,
 					    const char *fname)
 {
-	TALLOC_CTX *tmp_ctx = talloc_stackframe();
+	TALLOC_CTX *tmp_ctx;
 	const char *snapdir, *baseoffset, *basedir, *gmt_start;
 	size_t baselen;
 	char *ret;
@@ -593,7 +593,14 @@ static const char *shadow_copy2_connectpath(struct vfs_handle_struct *handle,
 		return handle->conn->connectpath;
 	}
 
-	fname = shadow_copy2_normalise_path(talloc_tos(), fname, gmt_start);
+        /*
+         * We have to create a real temporary context because we have
+         * to put our result on talloc_tos(). Thus we can't use a
+         * talloc_stackframe() here.
+         */
+	tmp_ctx = talloc_new(talloc_tos());
+
+	fname = shadow_copy2_normalise_path(tmp_ctx, fname, gmt_start);
 	if (fname == NULL) {
 		TALLOC_FREE(tmp_ctx);
 		return NULL;


-- 
Samba Shared Repository


More information about the samba-cvs mailing list