mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-24 03:08:51 +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:
@@ -132,8 +132,9 @@ dsl_prop_get_dd(dsl_dir_t *dd, const char *propname,
|
||||
if (inheriting) {
|
||||
dsl_dir_name(dd, setpoint);
|
||||
} else {
|
||||
(void) strcpy(setpoint,
|
||||
ZPROP_SOURCE_VAL_RECVD);
|
||||
(void) strlcpy(setpoint,
|
||||
ZPROP_SOURCE_VAL_RECVD,
|
||||
MAXNAMELEN);
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -206,8 +207,9 @@ dsl_prop_get_ds(dsl_dataset_t *ds, const char *propname,
|
||||
kmem_strfree(recvdstr);
|
||||
if (err != ENOENT) {
|
||||
if (setpoint != NULL && err == 0)
|
||||
(void) strcpy(setpoint,
|
||||
ZPROP_SOURCE_VAL_RECVD);
|
||||
(void) strlcpy(setpoint,
|
||||
ZPROP_SOURCE_VAL_RECVD,
|
||||
MAXNAMELEN);
|
||||
return (err);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user