From 3b89c0656c800177cbb086041978ab65450e5d5a Mon Sep 17 00:00:00 2001 From: Simo Sorce Date: Mon, 7 Apr 2003 18:03:02 +0000 Subject: fix wrong string handling thanks to Stefan (metzte) Metzmacher (This used to be commit 99c2e11ccfe04867e84b467b0e82de8415c1dcee) --- source3/modules/vfs_recycle.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'source3') 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 */ -- cgit