mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-24 19:28:53 +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:
+2
-2
@@ -6647,8 +6647,8 @@ spa_vdev_attach(spa_t *spa, uint64_t guid, nvlist_t *nvroot, int replacing)
|
||||
spa_strfree(oldvd->vdev_path);
|
||||
oldvd->vdev_path = kmem_alloc(strlen(newvd->vdev_path) + 5,
|
||||
KM_SLEEP);
|
||||
(void) sprintf(oldvd->vdev_path, "%s/%s",
|
||||
newvd->vdev_path, "old");
|
||||
(void) snprintf(oldvd->vdev_path, strlen(newvd->vdev_path) + 5,
|
||||
"%s/%s", newvd->vdev_path, "old");
|
||||
if (oldvd->vdev_devid != NULL) {
|
||||
spa_strfree(oldvd->vdev_devid);
|
||||
oldvd->vdev_devid = NULL;
|
||||
|
||||
Reference in New Issue
Block a user