diff options
author | Simo Sorce <idra@samba.org> | 2003-04-07 18:03:02 +0000 |
---|---|---|
committer | Simo Sorce <idra@samba.org> | 2003-04-07 18:03:02 +0000 |
commit | 3b89c0656c800177cbb086041978ab65450e5d5a (patch) | |
tree | a5f0d74969d3ebf88165fa8da23e6f6e7791aec4 /source3/modules/vfs_recycle.c | |
parent | 31e21b67d998eed46c55132cc6067db6163d30c1 (diff) | |
download | samba-3b89c0656c800177cbb086041978ab65450e5d5a.tar.gz samba-3b89c0656c800177cbb086041978ab65450e5d5a.tar.bz2 samba-3b89c0656c800177cbb086041978ab65450e5d5a.zip |
fix wrong string handling
thanks to Stefan (metzte) Metzmacher
(This used to be commit 99c2e11ccfe04867e84b467b0e82de8415c1dcee)
Diffstat (limited to 'source3/modules/vfs_recycle.c')
-rw-r--r-- | source3/modules/vfs_recycle.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/source3/modules/vfs_recycle.c b/source3/modules/vfs_recycle.c index a669d864c6..100db69cb6 100644 --- a/source3/modules/vfs_recycle.c +++ b/source3/modules/vfs_recycle.c @@ -552,9 +552,11 @@ static int recycle_unlink(connection_struct *conn, const char *file_name) goto done; } - temp_name = (char *)strdup(recbin->repository); + temp_name = (char *)malloc(PATH_MAX); ALLOC_CHECK(temp_name, done); - + safe_strcpy(temp_name, recbin->repository, PATH_MAX - 1); + *temp_name = '\0'; + /* see if we need to recreate the original directory structure in the recycle bin */ if (recbin->keep_dir_tree == True) { safe_strcat(temp_name, "/", PATH_MAX - 1); @@ -573,7 +575,6 @@ static int recycle_unlink(connection_struct *conn, const char *file_name) } } - final_name = NULL; asprintf(&final_name, "%s/%s", temp_name, base); ALLOC_CHECK(final_name, done); DEBUG(10, ("recycle.bin: recycled file name: %s\n", temp_name)); /* new filename with path */ |