summaryrefslogtreecommitdiffstats
path: root/module/zfs/dsl_dir.c
diff options
context:
space:
mode:
authorJorgen Lundman <[email protected]>2020-06-08 03:42:12 +0900
committerGitHub <[email protected]>2020-06-07 11:42:12 -0700
commitc9e319faae9677aa0dddfbf9973b9e8fc3feb06c (patch)
tree3d6677913e5f26d91b7f35bcb62b9b354287db61 /module/zfs/dsl_dir.c
parent60265072e02049be708f74cf0865eba2434a2d85 (diff)
Replace sprintf()->snprintf() and strcpy()->strlcpy()
The strcpy() and sprintf() functions are deprecated on some platforms. Care is needed to ensure correct size is used. If some platforms miss snprintf, we can add a #define to sprintf, likewise strlcpy(). The biggest change is adding a size parameter to zfs_id_to_fuidstr(). The various *_impl_get() functions are only used on linux and have not yet been updated. Reviewed by: Sean Eric Fagan <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Jorgen Lundman <[email protected]> Closes #10400
Diffstat (limited to 'module/zfs/dsl_dir.c')
-rw-r--r--module/zfs/dsl_dir.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/module/zfs/dsl_dir.c b/module/zfs/dsl_dir.c
index 63ecb1d39..d33d5ed93 100644
--- a/module/zfs/dsl_dir.c
+++ b/module/zfs/dsl_dir.c
@@ -245,7 +245,8 @@ dsl_dir_hold_obj(dsl_pool_t *dp, uint64_t ddobj,
if (err != 0)
goto errout;
} else {
- (void) strcpy(dd->dd_myname, spa_name(dp->dp_spa));
+ (void) strlcpy(dd->dd_myname, spa_name(dp->dp_spa),
+ sizeof (dd->dd_myname));
}
if (dsl_dir_is_clone(dd)) {
@@ -423,7 +424,7 @@ getcomponent(const char *path, char *component, const char **nextp)
return (SET_ERROR(EINVAL));
if (strlen(path) >= ZFS_MAX_DATASET_NAME_LEN)
return (SET_ERROR(ENAMETOOLONG));
- (void) strcpy(component, path);
+ (void) strlcpy(component, path, ZFS_MAX_DATASET_NAME_LEN);
p = NULL;
} else if (p[0] == '/') {
if (p - path >= ZFS_MAX_DATASET_NAME_LEN)