summaryrefslogtreecommitdiffstats
path: root/source3
diff options
context:
space:
mode:
authorMichael Adam <obnox@samba.org>2013-12-11 09:41:38 +0100
committerMichael Adam <obnox@samba.org>2013-12-11 19:55:20 +0100
commit27baff0ec96cded0446ecd7739e9d31aaeb90868 (patch)
tree7f1915a3e6e91ac03539312e213c68e3eb80950b /source3
parent71318d7d685f8e1e112076f84ef2d788acb83547 (diff)
downloadsamba-27baff0ec96cded0446ecd7739e9d31aaeb90868.tar.gz
samba-27baff0ec96cded0446ecd7739e9d31aaeb90868.tar.xz
samba-27baff0ec96cded0446ecd7739e9d31aaeb90868.zip
shadow_copy2: add a comment explaining why we don't talloc_zero_array().
Since I stumbled over this slighly sublte point, I thought it is worthwile to point it our in a comment. Signed-off-by: Michael Adam <obnox@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org> Autobuild-User(master): Michael Adam <obnox@samba.org> Autobuild-Date(master): Wed Dec 11 19:55:20 CET 2013 on sn-devel-104
Diffstat (limited to 'source3')
-rw-r--r--source3/modules/vfs_shadow_copy2.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/source3/modules/vfs_shadow_copy2.c b/source3/modules/vfs_shadow_copy2.c
index 7f5aeb24e3..fca05cf7ab 100644
--- a/source3/modules/vfs_shadow_copy2.c
+++ b/source3/modules/vfs_shadow_copy2.c
@@ -482,6 +482,15 @@ static char *shadow_copy2_convert(TALLOC_CTX *mem_ctx,
}
insertlen = talloc_get_size(insert)-1;
+ /*
+ * Note: We deliberatly don't expensively initialize the
+ * array with talloc_zero here: Putting zero into
+ * converted[pathlen+insertlen] below is sufficient, because
+ * in the following for loop, the insert string is inserted
+ * at various slash places. So the memory up to position
+ * pathlen+insertlen will always be initialized when the
+ * converted string is used.
+ */
converted = talloc_array(mem_ctx, char, pathlen + insertlen + 1);
if (converted == NULL) {
goto fail;