summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/system/dlt-system-filetransfer.c9
1 files changed, 2 insertions, 7 deletions
diff --git a/src/system/dlt-system-filetransfer.c b/src/system/dlt-system-filetransfer.c
index 504468b..786c13e 100644
--- a/src/system/dlt-system-filetransfer.c
+++ b/src/system/dlt-system-filetransfer.c
@@ -235,16 +235,14 @@ int send_one(char *src, FiletransferOptions const *opts, int which)
// Prepare all needed file names
char *fn = basename(src);
- char *fdir = malloc(strlen(src)+1);
+
+ char *fdir = strndup(src,PATH_MAX);
MALLOC_ASSERT(fdir);
- strncpy(fdir,src,strlen(src));
- *(fdir+strlen(fdir))='\0';
fdir = dirname(fdir);//dirname overwrites its argument anyway
char *dst_tosend;//file which is going to be sent
char *rn = unique_name(src);//new unique filename based on inode
-
MALLOC_ASSERT(fn);
MALLOC_ASSERT(rn);
@@ -263,9 +261,6 @@ int send_one(char *src, FiletransferOptions const *opts, int which)
snprintf(dst_tocompress,len,"%s/%s/%s",fdir,SUBDIR_COMPRESS,rn);
-
-
-
//moving in subdir, from where it can be compressed
if(rename(src, dst_tocompress) < 0)
{