mirror of
https://github.com/RsyncProject/rsync.git
synced 2026-01-29 01:01:53 -05:00
- Changed some sprintf() calls to snprintf() calls.
- Changed two last strcpy() calls to strlcpy() calls.
This commit is contained in:
10
flist.c
10
flist.c
@@ -1700,15 +1700,15 @@ static void output_flist(struct file_list *flist)
|
||||
for (i = 0; i < flist->count; i++) {
|
||||
file = flist->files[i];
|
||||
if ((am_root || am_sender) && preserve_uid)
|
||||
sprintf(uidbuf, " uid=%ld", (long)file->uid);
|
||||
snprintf(uidbuf, sizeof uidbuf, " uid=%ld", (long)file->uid);
|
||||
else
|
||||
*uidbuf = '\0';
|
||||
if (preserve_gid && file->gid != GID_NONE)
|
||||
sprintf(gidbuf, " gid=%ld", (long)file->gid);
|
||||
snprintf(gidbuf, sizeof gidbuf, " gid=%ld", (long)file->gid);
|
||||
else
|
||||
*gidbuf = '\0';
|
||||
if (!am_sender)
|
||||
sprintf(depthbuf, "%d", file->dir.depth);
|
||||
snprintf(depthbuf, sizeof depthbuf, "%d", file->dir.depth);
|
||||
rprintf(FINFO, "[%s] i=%d %s %s%s%s%s mode=0%o len=%.0f%s%s flags=%x\n",
|
||||
who, i, am_sender ? NS(file->dir.root) : depthbuf,
|
||||
file->dirname ? file->dirname : "",
|
||||
@@ -1876,9 +1876,9 @@ char *f_name(struct file_struct *f, char *fbuf)
|
||||
int len = strlen(f->dirname);
|
||||
memcpy(fbuf, f->dirname, len);
|
||||
fbuf[len] = '/';
|
||||
strcpy(fbuf + len + 1, f->basename);
|
||||
strlcpy(fbuf + len + 1, f->basename, MAXPATHLEN - (len + 1));
|
||||
} else
|
||||
strcpy(fbuf, f->basename);
|
||||
strlcpy(fbuf, f->basename, MAXPATHLEN);
|
||||
|
||||
return fbuf;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user