From 20e7868288d46f6ede60f32171b390de005071c6 Mon Sep 17 00:00:00 2001 From: Alan Somers Date: Tue, 30 May 2017 22:36:24 +0000 Subject: [PATCH] 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(-) diff --git a/sbin/mount/mount.c b/sbin/mount/mount.c index 1d35f3e91f5d..4b48f10a5c4a 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);