mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-25 03:37:45 +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:
@@ -101,9 +101,9 @@ dsl_dataset_user_hold_check(void *arg, dmu_tx_t *tx)
|
||||
size_t len = strlen(nvpair_name(pair)) +
|
||||
strlen(fnvpair_value_string(pair));
|
||||
char *nameval = kmem_zalloc(len + 2, KM_SLEEP);
|
||||
(void) strcpy(nameval, nvpair_name(pair));
|
||||
(void) strcat(nameval, "@");
|
||||
(void) strcat(nameval, fnvpair_value_string(pair));
|
||||
(void) strlcpy(nameval, nvpair_name(pair), len + 2);
|
||||
(void) strlcat(nameval, "@", len + 2);
|
||||
(void) strlcat(nameval, fnvpair_value_string(pair), len + 2);
|
||||
fnvlist_add_string(tmp_holds, nameval, "");
|
||||
kmem_free(nameval, len + 2);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user