svn commit: r244760 - head/sys/kern
David Xu
davidxu at FreeBSD.org
Fri Dec 28 02:43:34 UTC 2012
Author: davidxu
Date: Fri Dec 28 02:43:33 2012
New Revision: 244760
URL: http://svnweb.freebsd.org/changeset/base/244760
Log:
Use strlcpy to NULL-terminate error message even if user provided a short
buffer.
Modified:
head/sys/kern/vfs_mount.c
Modified: head/sys/kern/vfs_mount.c
==============================================================================
--- head/sys/kern/vfs_mount.c Fri Dec 28 01:42:32 2012 (r244759)
+++ head/sys/kern/vfs_mount.c Fri Dec 28 02:43:33 2012 (r244760)
@@ -559,7 +559,7 @@ vfs_donmount(struct thread *td, uint64_t
if (error || fstype[fstypelen - 1] != '\0') {
error = EINVAL;
if (errmsg != NULL)
- strncpy(errmsg, "Invalid fstype", errmsg_len);
+ strlcpy(errmsg, "Invalid fstype", errmsg_len);
goto bail;
}
fspathlen = 0;
@@ -567,7 +567,7 @@ vfs_donmount(struct thread *td, uint64_t
if (error || fspath[fspathlen - 1] != '\0') {
error = EINVAL;
if (errmsg != NULL)
- strncpy(errmsg, "Invalid fspath", errmsg_len);
+ strlcpy(errmsg, "Invalid fspath", errmsg_len);
goto bail;
}
@@ -1447,7 +1447,7 @@ vfs_filteropt(struct vfsoptlist *opts, c
if (ret != 0) {
TAILQ_FOREACH(opt, opts, link) {
if (strcmp(opt->name, "errmsg") == 0) {
- strncpy((char *)opt->value, errmsg, opt->len);
+ strlcpy((char *)opt->value, errmsg, opt->len);
break;
}
}
More information about the svn-src-all
mailing list