From f4b0c20057f88033c3667e71b4c4d2755a5dee61 Mon Sep 17 00:00:00 2001 From: asomers Date: Tue, 30 May 2017 22:36:24 +0000 Subject: MFC r316611: sbin/mount: strcpy -> strlcpy Reported by: Coverity CID: 1011173, 1011174 Sponsored by: Spectra Logic Corp --- sbin/mount/mount.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'sbin') diff --git a/sbin/mount/mount.c b/sbin/mount/mount.c index 1d35f3e..4b48f10 100644 --- a/sbin/mount/mount.c +++ b/sbin/mount/mount.c @@ -597,7 +597,7 @@ mountfs(const char *vfstype, const char *spec, const char *name, int flags, append_arg(&mnt_argv, execname); mangle(optbuf, &mnt_argv); if (mountprog != NULL) - strcpy(execname, mountprog); + strlcpy(execname, mountprog, sizeof(execname)); append_arg(&mnt_argv, strdup(spec)); append_arg(&mnt_argv, strdup(name)); @@ -905,8 +905,9 @@ putfsent(struct statfs *ent) if (strncmp(ent->f_mntfromname, "", 7) == 0 || strncmp(ent->f_mntfromname, "", 7) == 0) { - strcpy(ent->f_mntfromname, (strnstr(ent->f_mntfromname, ":", 8) - +1)); + strlcpy(ent->f_mntfromname, + (strnstr(ent->f_mntfromname, ":", 8) +1), + sizeof(ent->f_mntfromname)); } l = strlen(ent->f_mntfromname); -- cgit v1.1