summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--cmd/zfs/zfs_main.c2
-rw-r--r--cmd/zinject/zinject.c2
-rw-r--r--lib/libzfs/libzfs_changelist.c3
-rw-r--r--lib/libzfs/libzfs_diff.c2
-rwxr-xr-xlib/libzfs/libzfs_util.c4
5 files changed, 7 insertions, 6 deletions
diff --git a/cmd/zfs/zfs_main.c b/cmd/zfs/zfs_main.c
index a4ffb1f44..bf9a79248 100644
--- a/cmd/zfs/zfs_main.c
+++ b/cmd/zfs/zfs_main.c
@@ -6768,7 +6768,7 @@ zfs_do_bookmark(int argc, char **argv)
* Snapshot name begins with @.
* Default to same fs as bookmark.
*/
- (void) strncpy(snapname, argv[1], sizeof (snapname));
+ (void) strlcpy(snapname, argv[1], sizeof (snapname));
*strchr(snapname, '#') = '\0';
(void) strlcat(snapname, argv[0], sizeof (snapname));
} else {
diff --git a/cmd/zinject/zinject.c b/cmd/zinject/zinject.c
index 0ce50277d..396c52a0c 100644
--- a/cmd/zinject/zinject.c
+++ b/cmd/zinject/zinject.c
@@ -548,7 +548,7 @@ register_handler(const char *pool, int flags, zinject_record_t *record,
{
zfs_cmd_t zc = {"\0"};
- (void) strcpy(zc.zc_name, pool);
+ (void) strlcpy(zc.zc_name, pool, sizeof (zc.zc_name));
zc.zc_inject_record = *record;
zc.zc_guid = flags;
diff --git a/lib/libzfs/libzfs_changelist.c b/lib/libzfs/libzfs_changelist.c
index 5e007c0f4..ed11bb822 100644
--- a/lib/libzfs/libzfs_changelist.c
+++ b/lib/libzfs/libzfs_changelist.c
@@ -304,7 +304,8 @@ changelist_rename(prop_changelist_t *clp, const char *src, const char *dst)
remove_mountpoint(cn->cn_handle);
(void) strlcpy(newname, dst, sizeof (newname));
- (void) strcat(newname, cn->cn_handle->zfs_name + strlen(src));
+ (void) strlcat(newname, cn->cn_handle->zfs_name + strlen(src),
+ sizeof (newname));
(void) strlcpy(cn->cn_handle->zfs_name, newname,
sizeof (cn->cn_handle->zfs_name));
diff --git a/lib/libzfs/libzfs_diff.c b/lib/libzfs/libzfs_diff.c
index f5c799529..419189aa8 100644
--- a/lib/libzfs/libzfs_diff.c
+++ b/lib/libzfs/libzfs_diff.c
@@ -425,7 +425,7 @@ differ(void *arg)
if ((ofp = fdopen(di->outputfd, "w")) == NULL) {
di->zerr = errno;
- strncpy(di->errbuf, strerror(errno), sizeof (di->errbuf));
+ strlcpy(di->errbuf, strerror(errno), sizeof (di->errbuf));
(void) close(di->datafd);
return ((void *)-1);
}
diff --git a/lib/libzfs/libzfs_util.c b/lib/libzfs/libzfs_util.c
index 4988e8115..8fec78283 100755
--- a/lib/libzfs/libzfs_util.c
+++ b/lib/libzfs/libzfs_util.c
@@ -1107,8 +1107,8 @@ zfs_strcmp_pathname(char *name, char *cmp, int wholedisk)
dup = strdup(cmp);
dir = strtok(dup, "/");
while (dir) {
- strcat(cmp_name, "/");
- strcat(cmp_name, dir);
+ strlcat(cmp_name, "/", sizeof (cmp_name));
+ strlcat(cmp_name, dir, sizeof (cmp_name));
dir = strtok(NULL, "/");
}
free(dup);