mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-24 11:18:52 +03:00
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 <sef@ixsystems.com> Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Jorgen Lundman <lundman@lundman.net> Closes #10400
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user