dtfile: batch coverity fixes
This commit is contained in:
@@ -484,7 +484,7 @@ create_copydir_dialog(
|
||||
|
||||
/* Save the name of the source directory in order to truncate the pathname */
|
||||
/* displayed as the copy proceeds ... see function UpdateStatus. */
|
||||
strcpy(G_source_dir,source);
|
||||
snprintf(G_source_dir, sizeof(G_source_dir), "%s", source);
|
||||
|
||||
tsource = (char * )get_path(source);
|
||||
ttarget = (char * )get_path(target);
|
||||
|
||||
@@ -254,9 +254,9 @@ GetDirEntry(char *fname, FileOp *op, int *rc)
|
||||
/* get file name */
|
||||
p = strrchr(fname, '/');
|
||||
if (p && p > fname)
|
||||
strcpy(deP->name, p + 1);
|
||||
snprintf(deP->name, sizeof(deP->name), "%s", p + 1);
|
||||
else
|
||||
strcpy(deP->name, fname);
|
||||
snprintf(deP->name, sizeof(deP->name), "%s", fname);
|
||||
|
||||
/* assume everything is fine */
|
||||
*op = 0;
|
||||
@@ -321,7 +321,7 @@ GetDir(char *dirname, PatternList *xl, PatternList *sl, DirEntry **listPP)
|
||||
}
|
||||
|
||||
/* copy dirname to file name buffer */
|
||||
strcpy(fname, dirname);
|
||||
snprintf(fname, sizeof(fname), "%s", dirname);
|
||||
fnP = fname + strlen(fname);
|
||||
*fnP++ = '/';
|
||||
|
||||
@@ -410,8 +410,7 @@ doUnlink(char *fname, DirEntry *fP, int confirm)
|
||||
else if (SP->keepold) {
|
||||
char newname[1024];
|
||||
|
||||
strcpy(newname, fname);
|
||||
strcat(newname, SP->keepold);
|
||||
snprintf(newname, sizeof(newname), "%s%s", fname, SP->keepold);
|
||||
fsMove(fname, newname, 1, &rc);
|
||||
|
||||
} else if ((fP->ftype & ft_isdir) && !(fP->ftype & ft_islnk)) {
|
||||
@@ -941,8 +940,8 @@ SyncDirectory(SyncParams *p)
|
||||
|
||||
/* save pointer to params; copy source & target names */
|
||||
SP = p;
|
||||
strcpy(sbuf, SP->source);
|
||||
strcpy(tbuf, SP->target);
|
||||
snprintf(sbuf, sizeof(sbuf), "%s", SP->source);
|
||||
snprintf(tbuf, sizeof(tbuf), "%s", SP->target);
|
||||
|
||||
/* get info about the source */
|
||||
sP = GetDirEntry(sbuf, &op, &rc);
|
||||
|
||||
@@ -38,6 +38,8 @@
|
||||
****************************************************************************
|
||||
************************************<+>*************************************/
|
||||
|
||||
#include <limits.h>
|
||||
|
||||
/* Macros */
|
||||
#define MAX_PATH PATH_MAX
|
||||
|
||||
@@ -93,8 +95,8 @@ extern Widget G_rename_text;
|
||||
extern Widget G_toggle_main;
|
||||
extern Widget G_toggle_error;
|
||||
|
||||
extern char G_rename_oldname[];
|
||||
extern char G_source_dir[];
|
||||
extern char G_rename_oldname[MAX_PATH];
|
||||
extern char G_source_dir[MAX_PATH];
|
||||
extern int G_move;
|
||||
extern int G_do_copy;
|
||||
extern int G_pause_copy;
|
||||
|
||||
@@ -366,7 +366,7 @@ EmptyDir(char *sourceP, int rm, int force)
|
||||
return errno;
|
||||
|
||||
/* prepare source name */
|
||||
strcpy(srcname, sourceP);
|
||||
snprintf(srcname, sizeof(srcname), "%s", sourceP);
|
||||
srclen = strlen(srcname);
|
||||
if (srcname[srclen - 1] != '/')
|
||||
srcname[srclen++] = '/';
|
||||
@@ -486,7 +486,7 @@ fsMove(char *sourceP, char *targetP, int replace, int *rcP)
|
||||
/* first check if we have write permission in the source directory */
|
||||
char dir[1024], *p;
|
||||
|
||||
strcpy(dir, sourceP);
|
||||
snprintf(dir, sizeof(dir), "%s", sourceP);
|
||||
p = strrchr(dir, '/');
|
||||
if (p == 0)
|
||||
strcpy(dir, ".");
|
||||
|
||||
@@ -278,7 +278,7 @@ create_overwrite_dialog(
|
||||
|
||||
|
||||
/* save the target name for possible rename in ok_callback */
|
||||
strcpy(G_rename_oldname,tname);
|
||||
snprintf(G_rename_oldname, sizeof(G_rename_oldname), "%s", tname);
|
||||
|
||||
|
||||
if (G_move)
|
||||
|
||||
Reference in New Issue
Block a user